Graphite Version 3
An experimental 3D geometry processing program
Loading...
Searching...
No Matches
numeric.h File Reference

Types and functions for numbers manipulation. More...

#include <geogram/basic/common.h>
#include <geogram/basic/assert.h>
#include <geogram/basic/i387.h>
#include <cmath>
#include <float.h>
#include <limits.h>
#include <algorithm>
#include <stdint.h>
#include <limits>
#include <type_traits>
#include <iostream>
#include <cstdlib>

Go to the source code of this file.

Classes

struct  GEO::Numeric::LimitsHelper< T, is_numeric >
 Limits helper class that extends std::numeric_limits. More...
struct  GEO::Numeric::LimitsHelper< T, true >
 Specialization of LimitsHelper for numeric types. More...
struct  GEO::Numeric::Limits< T >
 Extends std::numeric_limits with additional information. More...
struct  GEO::is_scalar< T >
 type traits for scalars More...

Namespaces

namespace  GEO
 Global Vorpaline namespace.
namespace  GEO::Numeric
 Defines numeric types used in Vorpaline.

Macros

#define M_PI   3.14159265358979323846
 Value of the constant PI if not defined by the system.
#define GEO_FP_CONTRACT_OFF   _Pragma("STDC FP_CONTRACT OFF")
 add GEO_FP_CONTRACT_OFF at the beginning of files or functions where FMA operations should not be generated in place of a*b+c

Typedefs

typedef void * GEO::Numeric::pointer
typedef int8_t GEO::Numeric::int8
typedef int16_t GEO::Numeric::int16
typedef int32_t GEO::Numeric::int32
typedef int64_t GEO::Numeric::int64
typedef uint8_t GEO::Numeric::uint8
typedef uint16_t GEO::Numeric::uint16
typedef uint32_t GEO::Numeric::uint32
typedef uint64_t GEO::Numeric::uint64
typedef float GEO::Numeric::float32
typedef double GEO::Numeric::float64
typedef geo_index_t GEO::index_t
 The type for storing and manipulating indices.
typedef geo_signed_index_t GEO::signed_index_t
 The type for storing and manipulating indices differences.
typedef geo_coord_index_t GEO::coord_index_t
 The type for storing coordinate indices, and iterating on the coordinates of a point.

Enumerations

enum  GEO::Sign { GEO::NEGATIVE = -1 , GEO::ZERO = 0 , GEO::POSITIVE = 1 }
 Integer constants that represent the sign of a value. More...

Functions

template<class T>
Sign GEO::geo_cmp (const T &a, const T &b)
 Compares two values.
template<class T>
Sign GEO::geo_sgn (const T &x)
 Gets the sign of a value.
constexpr float32 GEO::Numeric::max_float32 ()
 Gets 32 bits float maximum positive value.
constexpr float32 GEO::Numeric::min_float32 ()
 Gets 32 bits float minimum negative value.
constexpr float64 GEO::Numeric::max_float64 ()
 Gets 64 bits float maximum positive value.
constexpr float64 GEO::Numeric::min_float64 ()
 Gets 64 bits float minimum negative value.
bool GEO::Numeric::is_nan (float32 x)
 Checks whether a 32 bits float is "not a number".
bool GEO::Numeric::is_nan (float64 x)
 Checks whether a 64 bits float is "not a number".
void GEO::Numeric::random_reset ()
 Resets the random number generator.
void GEO::Numeric::random_reset (int seed)
 Resets the random number generator.
int32 GEO::Numeric::random_int32 ()
 Returns a 32 bits integer between 0 and RAND_MAX.
float32 GEO::Numeric::random_float32 ()
 Returns a 32 bits float between 0 and 1.
float64 GEO::Numeric::random_float64 ()
 Returns a 64 bits float between 0 and 1.
template<class T>
void GEO::Numeric::optimize_number_representation (T &x)
 place holder for optimizing internal number representation
template<class T>
Sign GEO::Numeric::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.
template<class T>
T GEO::geo_sqr (T x)
 Gets the square value of a value.
template<class T>
void GEO::geo_clamp (T &x, T min, T max)
 Clamps a value to a range.
constexpr index_t GEO::max_index_t ()
 Gets the maximum positive value of type index_t.
constexpr signed_index_t GEO::max_signed_index_t ()
 Gets the maximum positive value of type signed_index_t.
signed_index_t GEO::min_signed_index_t ()
 Gets the minimum negative value of type signed_index_t.
double GEO::round (double x)

Detailed Description

Types and functions for numbers manipulation.

Definition in file numeric.h.

Macro Definition Documentation

◆ GEO_FP_CONTRACT_OFF

#define GEO_FP_CONTRACT_OFF   _Pragma("STDC FP_CONTRACT OFF")

add GEO_FP_CONTRACT_OFF at the beginning of files or functions where FMA operations should not be generated in place of a*b+c

it is important for instance for geometric predicates, that rely on strict IEEE754 implementation of product and addition.

Definition at line 462 of file numeric.h.

◆ M_PI

#define M_PI   3.14159265358979323846

Value of the constant PI if not defined by the system.

Definition at line 60 of file numeric.h.