walberla::math::Limits< Type > Struct Template Reference

Detailed Description

template<typename Type>
struct walberla::math::Limits< Type >

Numerical limits of built-in data types.

The Limits class provides numerical limits for the following built-in data types:

  • Integral data types
    • unsigned char, signed char, char, wchar_t
    • unsigned short, short
    • unsigned int, int
    • unsigned long, long
    • size_t, ptrdiff_t (for certain 64-bit compilers)
  • Floating point data types
    • float
    • double
    • long double

Depending on the data type, the following limits can be used:

  • inf: The inf function is defined for all built-in data types. It returns the largest possible positive value of the according data type.
  • ninf: The ninf function is defined for all signed integral and all floating point data types. It returns the largest possible negative value of the according data type.
  • epsilon: The epsilon function is defined for all floating point data types and returns the smallest possible difference between two values of the according data type.
  • accuracy: The accuracy function is defined for all floating point data types and returns the computation accuracy of the corresponding data type. Due to the limited floating point accuracy of a CPU this value is needed as computation threshold. This value is used in most computations throughout the physics engine.
  • fpuAccuracy: The fpuAccuracy function is defined for all floating point data types and returns the floating point accuracy of the according point data type. Due to the limited floating point accuracy of a CPU this value is needed as zero threshold in computations.

Code examples:

// Positiv infinity value
unsigned int ui = Limits<unsigned int>::inf();
// Negative infinity value
double d = Limits<double>::ninf();

#include <Limits.h>


The documentation for this struct was generated from the following file: