#include <algorithm>
#include <cmath>
#include "CoinFinite.hpp"
Include dependency graph for CoinFloatEqual.hpp:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Classes | |
| class | CoinAbsFltEq |
| Equality to an absolute tolerance. More... | |
| class | CoinRelFltEq |
| Equality to a scaled tolerance. More... | |
Two objects are provided; one tests for equality to an absolute tolerance, one to a scaled tolerance. The tests will handle IEEE floating point, but note that infinity == infinity. Mathematicians are rolling in their graves, but this matches the behaviour for the common practice of using DBL_MAX (numeric_limits<double>::max(), or similar large finite number) as infinity.
Example usage:
double d1 = 3.14159 ;
double d2 = d1 ;
double d3 = d1+.0001 ;
CoinAbsFltEq eq1 ;
CoinAbsFltEq eq2(.001) ;
assert( eq1(d1,d2) ) ;
assert( !eq1(d1,d3) ) ;
assert( eq2(d1,d3) ) ;
Definition in file CoinFloatEqual.hpp.
1.4.7