diff options
| author | Steve M. Robbins <smr@sumost.ca> | 2007-03-05 02:17:27 +0000 |
|---|---|---|
| committer | Steve M. Robbins <smr@sumost.ca> | 2007-03-05 02:17:27 +0000 |
| commit | 74b3222b58ac7fc3ac2740ab121586a5ac4ef8fe (patch) | |
| tree | 47e1fe3e960693f3410a47818b56e43fc68132d9 /include/cppunit | |
| parent | 82fb2eaf5c99b6399824128495af32c8c0570df8 (diff) | |
| download | cppunit-74b3222b58ac7fc3ac2740ab121586a5ac4ef8fe.tar.gz | |
Make floatingPointIsFinite() return int. Fix comment about comparisons and IEEE NaN.
Diffstat (limited to 'include/cppunit')
| -rw-r--r-- | include/cppunit/portability/FloatingPoint.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/include/cppunit/portability/FloatingPoint.h b/include/cppunit/portability/FloatingPoint.h index 584c433..e8c91b3 100644 --- a/include/cppunit/portability/FloatingPoint.h +++ b/include/cppunit/portability/FloatingPoint.h @@ -7,8 +7,11 @@ CPPUNIT_NS_BEGIN /// \brief Tests if a floating-point is a NaN. -// According to IEEE-754 floating point standard, NaN comparison should always -// be 'false'. +// According to IEEE-754 floating point standard, +// (see e.g. page 8 of +// http://www.cs.berkeley.edu/~wkahan/ieee754status/ieee754.ps) +// all comparisons with NaN are false except "x != x", which is true. +// // At least Microsoft Visual Studio 6 is known not to implement this test correctly. // It emits the following code to test equality: // fcomp qword ptr [nan] @@ -32,12 +35,12 @@ inline bool floatingPointIsUnordered( double x ) /// \brief Tests if a floating-point is finite. /// @return \c true if x is neither a NaN, nor +inf, nor -inf, \c false otherwise. -inline bool floatingPointIsFinite( double x ) +inline int floatingPointIsFinite( double x ) { #if defined(CPPUNIT_HAVE_ISFINITE) - return (bool)isfinite( x ); + return isfinite( x ); #elif defined(CPPUNIT_HAVE_FINITE) - return (bool)finite( x ); + return finite( x ); #elif defined(CPPUNIT_HAVE__FINITE) return _finite(x); #else |
