Gromacs
2016.4

#include <testutils/testasserts.h>
Computes and represents a floatingpoint difference value.
Methods in this class do not throw, except for toString(), which may throw std::bad_alloc.
Public Member Functions  
FloatingPointDifference (float value1, float value2)  
Initializes a singleprecision difference.  
FloatingPointDifference (double value1, double value2)  
Initializes a doubleprecision difference.  
bool  isNaN () const 
Whether one or both of the compared values were NaN. More...  
double  asAbsolute () const 
Returns the difference as an absolute number (always nonnegative).  
gmx_uint64_t  asUlps () const 
Returns the difference as ULPs (always nonnegative). More...  
bool  signsDiffer () const 
Whether the compared values were of different sign. More...  
bool  isDouble () const 
Whether the difference is between single or doubleprecision numbers.  
std::string  toString () const 
Formats the difference as a string for assertion failure messages.  

inline 
Returns the difference as ULPs (always nonnegative).
The ULPs are calculated for the type that corresponds to the constructor used to initialize the difference. The ULP difference between 0.0 and 0.0 is zero.
bool gmx::test::FloatingPointDifference::isNaN  (  )  const 
Whether one or both of the compared values were NaN.
If this returns true
, other accessors return meaningless values.

inline 
Whether the compared values were of different sign.
0.0 and 0.0 are treated as positive and negative, respectively.