Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2008-04-15 13:30:03


Author: johnmaddock
Date: 2008-04-15 13:30:03 EDT (Tue, 15 Apr 2008)
New Revision: 44434
URL: http://svn.boost.org/trac/boost/changeset/44434

Log:
Add some explicit casts from the FP_* macros to type int, so that comparisons actually work when building with GCC, this is GCC bug report: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20589.
Text files modified:
   trunk/boost/math/special_functions/fpclassify.hpp | 10 +++++-----
   trunk/boost/math/special_functions/gamma.hpp | 6 +++---
   2 files changed, 8 insertions(+), 8 deletions(-)

Modified: trunk/boost/math/special_functions/fpclassify.hpp
==============================================================================
--- trunk/boost/math/special_functions/fpclassify.hpp (original)
+++ trunk/boost/math/special_functions/fpclassify.hpp 2008-04-15 13:30:03 EDT (Tue, 15 Apr 2008)
@@ -73,7 +73,7 @@
 #ifdef isnan
    return isnan(t);
 #else // BOOST_HAS_FPCLASSIFY
- return (BOOST_FPCLASSIFY_PREFIX fpclassify(t) == FP_NAN);
+ return (BOOST_FPCLASSIFY_PREFIX fpclassify(t) == (int)FP_NAN);
 #endif
 }
 
@@ -200,19 +200,19 @@
 inline bool isfinite BOOST_NO_MACRO_EXPAND(T z)
 {
    int t = (::boost::math::fpclassify)(z);
- return (t != FP_NAN) && (t != FP_INFINITE);
+ return (t != (int)FP_NAN) && (t != (int)FP_INFINITE);
 }
 
 template <class T>
 inline bool isinf BOOST_NO_MACRO_EXPAND(T t)
 {
- return (::boost::math::fpclassify)(t) == FP_INFINITE;
+ return (::boost::math::fpclassify)(t) == (int)FP_INFINITE;
 }
 
 template <class T>
 inline bool isnan BOOST_NO_MACRO_EXPAND(T t)
 {
- return (::boost::math::fpclassify)(t) == FP_NAN;
+ return (::boost::math::fpclassify)(t) == (int)FP_NAN;
 }
 #ifdef isnan
 template <> inline bool isnan BOOST_NO_MACRO_EXPAND<float>(float t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); }
@@ -232,7 +232,7 @@
 template <class T>
 inline bool isnormal BOOST_NO_MACRO_EXPAND(T t)
 {
- return (::boost::math::fpclassify)(t) == FP_NORMAL;
+ return (::boost::math::fpclassify)(t) == (int)FP_NORMAL;
 }
 
 } // namespace math

Modified: trunk/boost/math/special_functions/gamma.hpp
==============================================================================
--- trunk/boost/math/special_functions/gamma.hpp (original)
+++ trunk/boost/math/special_functions/gamma.hpp 2008-04-15 13:30:03 EDT (Tue, 15 Apr 2008)
@@ -152,7 +152,7 @@
       result = -boost::math::constants::pi<T>() / result;
       if(result == 0)
          return policies::raise_underflow_error<T>(function, "Result of tgamma is too small to represent.", pol);
- if((boost::math::fpclassify)(result) == FP_SUBNORMAL)
+ if((boost::math::fpclassify)(result) == (int)FP_SUBNORMAL)
          return policies::raise_denorm_error<T>(function, "Result of tgamma is denormalized.", result, pol);
       return result;
    }
@@ -352,7 +352,7 @@
       result = -boost::math::constants::pi<T>() / result;
       if(result == 0)
          return policies::raise_underflow_error<T>(function, "Result of tgamma is too small to represent.", pol);
- if((boost::math::fpclassify)(result) == FP_SUBNORMAL)
+ if((boost::math::fpclassify)(result) == (int)FP_SUBNORMAL)
          return policies::raise_denorm_error<T>(function, "Result of tgamma is denormalized.", result, pol);
       return result;
    }
@@ -584,7 +584,7 @@
    // This error handling isn't very good: it happens after the fact
    // rather than before it...
    //
- if((boost::math::fpclassify)(prefix) == FP_INFINITE)
+ if((boost::math::fpclassify)(prefix) == (int)FP_INFINITE)
       policies::raise_overflow_error<T>("boost::math::detail::full_igamma_prefix<%1%>(%1%, %1%)", "Result of incomplete gamma function is too large to represent.", pol);
 
    return prefix;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk