mirror of
https://github.com/boostorg/math.git
synced 2026-01-27 07:02:08 +00:00
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.
[SVN r44434]
This commit is contained in:
@@ -73,7 +73,7 @@ inline bool is_nan_helper(T t, const boost::true_type&)
|
||||
#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 @@ template <class T>
|
||||
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 <> inline bool isnan BOOST_NO_MACRO_EXPAND<long double>(long double t){
|
||||
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
|
||||
|
||||
@@ -152,7 +152,7 @@ T gamma_imp(T z, const Policy& pol, const L& l)
|
||||
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 @@ T gamma_imp(T z, const Policy& pol, const lanczos::undefined_lanczos& l)
|
||||
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 @@ T full_igamma_prefix(T a, T z, const Policy& pol)
|
||||
// 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;
|
||||
|
||||
Reference in New Issue
Block a user