[Cppunit-cvs] cppunit/include/cppunit/portability FloatingPoint.h, 1.2, 1.3
Brought to you by:
blep
From: Steven R. <sm...@us...> - 2007-03-05 03:17:33
|
Update of /cvsroot/cppunit/cppunit/include/cppunit/portability In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv25848/include/cppunit/portability Modified Files: FloatingPoint.h Log Message: Make floatingPointIsFinite() return int. Fix comment about comparisons and IEEE NaN. Index: FloatingPoint.h =================================================================== RCS file: /cvsroot/cppunit/cppunit/include/cppunit/portability/FloatingPoint.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FloatingPoint.h 25 Feb 2007 03:54:35 -0000 1.2 --- FloatingPoint.h 5 Mar 2007 03:17:27 -0000 1.3 *************** *** 8,13 **** /// \brief Tests if a floating-point is a NaN. ! // According to IEEE-754 floating point standard, NaN comparison should always ! // be 'false'. // At least Microsoft Visual Studio 6 is known not to implement this test correctly. // It emits the following code to test equality: --- 8,16 ---- /// \brief Tests if a floating-point is a NaN. ! // 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: *************** *** 33,42 **** /// \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 ) { #if defined(CPPUNIT_HAVE_ISFINITE) ! return (bool)isfinite( x ); #elif defined(CPPUNIT_HAVE_FINITE) ! return (bool)finite( x ); #elif defined(CPPUNIT_HAVE__FINITE) return _finite(x); --- 36,45 ---- /// \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 int floatingPointIsFinite( double x ) { #if defined(CPPUNIT_HAVE_ISFINITE) ! return isfinite( x ); #elif defined(CPPUNIT_HAVE_FINITE) ! return finite( x ); #elif defined(CPPUNIT_HAVE__FINITE) return _finite(x); |