Geogram  Version 1.9.1
A programming library of geometric algorithms
GEO::Numeric Namespace Reference

Defines numeric types used in Vorpaline. More...

Classes

struct  LimitsHelper
 Limits helper class that extends std::numeric_limits. More...
 
struct  LimitsHelper< T, true >
 Specialization of LimitsHelper for numeric types. More...
 
struct  Limits
 Extends std::numeric_limits with additional information. More...
 

Typedefs

typedef void * pointer
 
typedef int8_t int8
 
typedef int16_t int16
 
typedef int32_t int32
 
typedef int64_t int64
 
typedef uint8_t uint8
 
typedef uint16_t uint16
 
typedef uint32_t uint32
 
typedef uint64_t uint64
 
typedef float float32
 
typedef double float64
 

Functions

float32 max_float32 ()
 Gets 32 bits float maximum positive value.
 
float32 min_float32 ()
 Gets 32 bits float minimum negative value.
 
float64 max_float64 ()
 Gets 64 bits float maximum positive value.
 
float64 min_float64 ()
 Gets 64 bits float minimum negative value.
 
bool is_nan (float32 x)
 Checks whether a 32 bits float is "not a number".
 
bool is_nan (float64 x)
 Checks whether a 64 bits float is "not a number".
 
void random_reset ()
 Resets the random number generator.
 
int32 random_int32 ()
 Returns a 32 bits integer between 0 and RAND_MAX.
 
float32 random_float32 ()
 Returns a 32 bits float between 0 and 1.
 
float64 random_float64 ()
 Returns a 64 bits float between 0 and 1.
 
template<class T >
void optimize_number_representation (T &x)
 place holder for optimizing internal number representation More...
 
template<class T >
Sign ratio_compare (const T &a_num, const T &a_denom, const T &b_num, const T &b_denom)
 Compares two rational numbers given as separate numerators and denominators. More...
 
template<class T >
void optimize_number_representation (rationalg< T > &x)
 
template<class T >
void optimize_number_representation (vecng< 2, T > &v)
 
template<class T >
void optimize_number_representation (vecng< 3, T > &v)
 
template<class T >
void optimize_number_representation (vec2Hg< T > &v)
 
template<class T >
void optimize_number_representation (vec3Hg< T > &v)
 
template<>
void optimize_number_representation (expansion_nt &x)
 
template<>
Sign ratio_compare (const expansion_nt &a_num, const expansion_nt &a_denom, const expansion_nt &b_num, const expansion_nt &b_denom)
 Compares two rational numbers given as separate numerators and denominators. Specialization for exact_nt. More...
 

Detailed Description

Defines numeric types used in Vorpaline.

These types names have the form (u)int<size> or float<size>, where the (optional) u denotes an unsigned type, and the size is in bits.

Typedef Documentation

◆ float32

typedef float GEO::Numeric::float32

Floating point type with a width of 32 bits

Definition at line 147 of file numeric.h.

◆ float64

typedef double GEO::Numeric::float64

Floating point type with a width of 64 bits

Definition at line 150 of file numeric.h.

◆ int16

typedef int16_t GEO::Numeric::int16

Integer type with a width of 16 bits

Definition at line 126 of file numeric.h.

◆ int32

typedef int32_t GEO::Numeric::int32

Integer type with a width of 32 bits

Definition at line 129 of file numeric.h.

◆ int64

typedef int64_t GEO::Numeric::int64

Integer type with a width of 64 bits

Definition at line 132 of file numeric.h.

◆ int8

typedef int8_t GEO::Numeric::int8

Integer type with a width of 8 bits

Definition at line 123 of file numeric.h.

◆ pointer

typedef void* GEO::Numeric::pointer

Generic pointer type

Definition at line 120 of file numeric.h.

◆ uint16

typedef uint16_t GEO::Numeric::uint16

Unsigned integer type with a width of 16 bits

Definition at line 138 of file numeric.h.

◆ uint32

typedef uint32_t GEO::Numeric::uint32

Unsigned integer type with a width of 32 bits

Definition at line 141 of file numeric.h.

◆ uint64

typedef uint64_t GEO::Numeric::uint64

Unsigned integer type with a width of 64 bits

Definition at line 144 of file numeric.h.

◆ uint8

typedef uint8_t GEO::Numeric::uint8

Unsigned integer type with a width of 8 bits

Definition at line 135 of file numeric.h.

Function Documentation

◆ optimize_number_representation()

template<class T >
void GEO::Numeric::optimize_number_representation ( T &  x)
inline

place holder for optimizing internal number representation

there are specializations for expansion_nt, rational_nt

Definition at line 267 of file numeric.h.

◆ ratio_compare() [1/2]

template<>
Sign GEO::Numeric::ratio_compare ( const expansion_nt a_num,
const expansion_nt a_denom,
const expansion_nt b_num,
const expansion_nt b_denom 
)

Compares two rational numbers given as separate numerators and denominators. Specialization for exact_nt.

Parameters
[in]a_num,a_denomdefines a = a_num / a_denom
[in]b_num,b_denomdefines b = b_num / b_denom
Returns
the sign of a - b

◆ ratio_compare() [2/2]

template<class T >
Sign GEO::Numeric::ratio_compare ( const T &  a_num,
const T &  a_denom,
const T &  b_num,
const T &  b_denom 
)
inline

Compares two rational numbers given as separate numerators and denominators.

Parameters
[in]a_num,a_denomdefines a = a_num / a_denom
[in]b_num,b_denomdefines b = b_num / b_denom
Returns
the sign of a - b

Definition at line 278 of file numeric.h.