KrisLibrary  1.0.0
Namespaces | Functions
infnan.h File Reference

Cross-platform infinity and not-a-number routines. More...

#include <math.h>
#include <limits>

Go to the source code of this file.

Namespaces

 Math
 Contains all definitions in the Math package.
 

Functions

int Math::IsNaN (double x)
 Returns nonzero if x is not-a-number (NaN)
 
int Math::IsNaN (float x)
 
int Math::IsFinite (double x)
 Returns nonzero unless x is infinite or a NaN.
 
int Math::IsFinite (float x)
 
int Math::IsInf (double x)
 Returns +1 if x is +inf, -1 if x is -inf, and 0 otherwise.
 
int Math::IsInf (float x)
 

Detailed Description

Cross-platform infinity and not-a-number routines.

Warning: if INFINITY is not defined as a constant, this uses the STL numeric_limits<T>::infinity() call. Global static members set to Inf will NOT necessarily be initialized properly on certain platforms, e.g., Windows. The solution is to avoid declaring static variables equal to infinity.