1 #include "W32Compat.hh"
2 #include <Base/Common/CompareFloatingPoint.hh>
12 {
return static_cast<T
>(rint(input)); }
14 template <> BIASCommon_EXPORT
18 template <> BIASCommon_EXPORT
20 {
return static_cast<float>(input); }
23 bool Equal(
const T left,
const T right,
const T eps)
28 template <> BIASCommon_EXPORT
33 if (left==right)
return true;
35 if (left==0. || right==0.){
36 return (fabs(left-right) <= eps);
39 return ( fabs(left-right) <= eps * fabs(right) ||
40 fabs(left-right) <= eps * fabs(left) );
43 template <> BIASCommon_EXPORT
48 if (left==right)
return true;
50 if (left==0. || right==0.){
51 return (fabs(left-right) <= eps);
54 return (fabs(left-right) <= eps * fabs(right) ||
55 fabs(left-right) <= eps * fabs(left) );
66 template BIASCommon_EXPORT type BIAS::Cast<type>(const double);\
67 template BIASCommon_EXPORT bool BIAS::Equal<type>(const type left, const type right, const type eps);
T Cast(const double input)
correct casting to storage type, incorporates rint for integer values and simple casting for floating...
BIASCommon_EXPORT bool Equal< double >(const double left, const double right, const double eps)
BIASCommon_EXPORT float Cast< float >(const double input)
BIASCommon_EXPORT double Cast< double >(const double input)
BIASCommon_EXPORT bool Equal< float >(const float left, const float right, const float eps)
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_...