21 #ifndef _CompareFloatingPoint_hh_
22 #define _CompareFloatingPoint_hh_
24 #include <bias_config.h>
43 bool Equal(
const T left,
const T right,
44 const T eps = std::numeric_limits<T>::epsilon());
50 inline bool Less(
const T left,
const T right,
51 const T eps = std::numeric_limits<T>::epsilon())
52 {
if (left==0. || right==0.)
return (right-left) > eps;
53 return ((right-left) > eps * std::min(right,left)); }
59 const T eps = std::numeric_limits<T>::epsilon())
60 {
return (
Less(left, right, eps) ||
Equal(left, right, eps)); }
65 inline bool Greater(
const T left,
const T right,
66 const T eps = std::numeric_limits<T>::epsilon())
67 {
if (left==0. || right==0.)
return (left-right) > eps;
68 return ((left-right) > eps * std::min(right,left)); }
74 const T eps = std::numeric_limits<T>::epsilon())
75 {
return (
Greater(left,right) ||
Equal(left, right, eps)); }
79 template <
typename T> BIASCommon_EXPORT
80 T
Cast(
const double input);
84 #endif // _CompareFloatingPoint_hh_
bool Less(const T left, const T right, const T eps=std::numeric_limits< T >::epsilon())
comparison function for floating point values
T Cast(const double input)
correct casting to storage type, incorporates rint for integer values and simple casting for floating...
bool Greater(const T left, const T right, const T eps=std::numeric_limits< T >::epsilon())
comparison function for floating point values
bool GreaterEqual(const T left, const T right, const T eps=std::numeric_limits< T >::epsilon())
comparison function for floating point values
bool LessEqual(const T left, const T right, const T eps=std::numeric_limits< T >::epsilon())
comparison function for floating point values
bool Equal(const T left, const T right, const T eps)
comparison function for floating point values See http://www.boost.org/libs/test/doc/components/test_...