Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86346 - trunk/boost/math/special_functions
From: john_at_[hidden]
Date: 2013-10-18 04:56:42


Author: johnmaddock
Date: 2013-10-18 04:56:42 EDT (Fri, 18 Oct 2013)
New Revision: 86346
URL: http://svn.boost.org/trac/boost/changeset/86346

Log:
Previous commit failed for types with an extended exponent range - use logarithms rather than assuming the result is zero.

Text files modified:
   trunk/boost/math/special_functions/bessel.hpp | 7 ++-----
   1 files changed, 2 insertions(+), 5 deletions(-)

Modified: trunk/boost/math/special_functions/bessel.hpp
==============================================================================
--- trunk/boost/math/special_functions/bessel.hpp Fri Oct 18 04:14:13 2013 (r86345)
+++ trunk/boost/math/special_functions/bessel.hpp 2013-10-18 04:56:42 EDT (Fri, 18 Oct 2013) (r86346)
@@ -50,11 +50,8 @@
       mult = x / 2;
       if(v + 3 > max_factorial<T>::value)
       {
- // term = v * log(mult) - boost::math::lgamma(v+1+T(0.5f), Policy());
- // term = exp(term);
- // Denominator increases faster than numerator each time v increases by one,
- // so if tgamma would overflow then the result is necessarily zero.
- term = 0;
+ term = v * log(mult) - boost::math::lgamma(v+1+T(0.5f), Policy());
+ term = exp(term);
       }
       else
          term = pow(mult, T(v)) / boost::math::tgamma(v+1+T(0.5f), 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