mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
more portability fixes
This commit is contained in:
@@ -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>
|
||||
|
Reference in New Issue
Block a user