more portability fixes

This commit is contained in:
Phil Nash
2010-11-12 08:12:01 +00:00
parent 9e4708371e
commit 7e8cfa714f
7 changed files with 13 additions and 8 deletions

View File

@@ -218,6 +218,11 @@ private:
#define CATCH_absTol 1e-10
#define CATCH_relTol 1e-10
inline double catch_max( double x, double y )
{
return x > y ? x : y;
}
class Approx
{
public:
@@ -232,7 +237,7 @@ public:
// !TBD Use proper tolerance
// From: http://realtimecollisiondetection.net/blog/?p=89
// see also: http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
return fabs( lhs - rhs.m_d ) <= std::max( CATCH_absTol, CATCH_relTol * std::max( fabs(lhs), fabs(rhs.m_d) ) );
return fabs( lhs - rhs.m_d ) <= catch_max( CATCH_absTol, CATCH_relTol * catch_max( fabs(lhs), fabs(rhs.m_d) ) );
}
template<typename T>