Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74185 - trunk/boost/math/special_functions
From: john_at_[hidden]
Date: 2011-09-01 14:03:32


Author: johnmaddock
Date: 2011-09-01 14:03:31 EDT (Thu, 01 Sep 2011)
New Revision: 74185
URL: http://svn.boost.org/trac/boost/changeset/74185

Log:
Fix usage with expression template types.
Fix fpclassify code when both BOOST_MATH_DISABLE_STD_FPCLASSIFY and isnan are defined.
Remove dead code.
Text files modified:
   trunk/boost/math/special_functions/ellint_3.hpp | 17 +----------------
   trunk/boost/math/special_functions/fpclassify.hpp | 5 ++---
   trunk/boost/math/special_functions/gamma.hpp | 2 +-
   3 files changed, 4 insertions(+), 20 deletions(-)

Modified: trunk/boost/math/special_functions/ellint_3.hpp
==============================================================================
--- trunk/boost/math/special_functions/ellint_3.hpp (original)
+++ trunk/boost/math/special_functions/ellint_3.hpp 2011-09-01 14:03:31 EDT (Thu, 01 Sep 2011)
@@ -182,7 +182,7 @@
     }
     else
     {
- T rphi = boost::math::tools::fmod_workaround(fabs(phi), T(constants::pi<T>() / 2));
+ T rphi = boost::math::tools::fmod_workaround(T(fabs(phi)), T(constants::pi<T>() / 2));
        T m = floor((2 * fabs(phi)) / constants::pi<T>());
        int sign = 1;
        if(boost::math::tools::fmod_workaround(m, T(2)) > 0.5)
@@ -191,21 +191,6 @@
           sign = -1;
           rphi = constants::pi<T>() / 2 - rphi;
        }
-#if 0
- //
- // This wasn't supported but is now... probably!
- //
- if((m > 0) && (v > 1))
- {
- //
- // The region with v > 1 and phi outside [0, pi/2] is
- // currently unsupported:
- //
- return policies::raise_domain_error<T>(
- function,
- "Got v = %1%, but this is only supported for 0 <= phi <= pi/2", v, pol);
- }
-#endif
        T sinp = sin(rphi);
        T cosp = cos(rphi);
        x = cosp * cosp;

Modified: trunk/boost/math/special_functions/fpclassify.hpp
==============================================================================
--- trunk/boost/math/special_functions/fpclassify.hpp (original)
+++ trunk/boost/math/special_functions/fpclassify.hpp 2011-09-01 14:03:31 EDT (Thu, 01 Sep 2011)
@@ -87,7 +87,6 @@
 
 namespace boost{
 
-#if (defined(BOOST_HAS_FPCLASSIFY) || defined(isnan)) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY)
 //
 // This must not be located in any namespace under boost::math
 // otherwise we can get into an infinite loop if isnan is
@@ -100,6 +99,8 @@
 {
 #ifdef isnan
    return isnan(t);
+#elif defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) || !defined(BOOST_HAS_FPCLASSIFY)
+ return false;
 #else // BOOST_HAS_FPCLASSIFY
    return (BOOST_FPCLASSIFY_PREFIX fpclassify(t) == (int)FP_NAN);
 #endif
@@ -113,8 +114,6 @@
 
 }
 
-#endif // defined(BOOST_HAS_FPCLASSIFY) || defined(isnan)
-
 namespace math{
 
 namespace detail{

Modified: trunk/boost/math/special_functions/gamma.hpp
==============================================================================
--- trunk/boost/math/special_functions/gamma.hpp (original)
+++ trunk/boost/math/special_functions/gamma.hpp 2011-09-01 14:03:31 EDT (Thu, 01 Sep 2011)
@@ -433,7 +433,7 @@
    }
    else if((z != 1) && (z != 2))
    {
- T limit = (std::max)(z+1, T(10));
+ T limit = (std::max)(T(z+1), T(10));
       T prefix = z * log(limit) - limit;
       T sum = detail::lower_gamma_series(z, limit, pol) / z;
       sum += detail::upper_gamma_fraction(z, limit, ::boost::math::policies::get_epsilon<T, Policy>());


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