utility/numutil.h File Reference

#include <cmath>
#include <cfloat>
#include <limits>
Include dependency graph for numutil.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define M_PI   3.14159265358979323846
#define M_E   2.7182818284590452353

Functions

template<class T >
bool isNaN (T value)
template<typename T >
bool isInfinity (T value)
template<class T >
bool isClose (T a, T b, T tolerance)
bool almostEqual (float x, float y, float epsilon=FLT_EPSILON)
bool almostEqual (double x, double y, double epsilon=DBL_EPSILON)
bool almostEqual (long double x, long double y, long double epsilon=LDBL_EPSILON)

Variables

const int WORD_LENGTH = 32
const double LN2 = 0.69314718055994528622676
const unsigned long LN2BYTES = 0xB1721814
const double NATURAL_E = 2.718281828459045

Define Documentation

#define M_E   2.7182818284590452353
#define M_PI   3.14159265358979323846

Function Documentation

bool almostEqual ( long double  x,
long double  y,
long double  epsilon = LDBL_EPSILON 
)
bool almostEqual ( double  x,
double  y,
double  epsilon = DBL_EPSILON 
)
bool almostEqual ( float  x,
float  y,
float  epsilon = FLT_EPSILON 
)
template<class T >
bool isClose ( a,
b,
tolerance 
) [inline]

Check 2 floating-point numbers for "equality". Algorithm (from Knuth) 'a' and 'b' are close if: | ( a - b ) / a | < e AND | ( a - b ) / b | < e where 'e' is a small number.

In this function, 'e' is computed as: e = tolerance * machine-epsilon

template<typename T >
bool isInfinity ( value  )  [inline]
template<class T >
bool isNaN ( value  )  [inline]

Functions for floating point comparisons

Referenced by SteadyState::classifyState().


Variable Documentation

const double LN2 = 0.69314718055994528622676
const unsigned long LN2BYTES = 0xB1721814
const double NATURAL_E = 2.718281828459045
const int WORD_LENGTH = 32

Generated on 1 Jul 2015 for MOOSE by  doxygen 1.6.1