mirror of
https://github.com/boostorg/math.git
synced 2026-01-29 19:52:08 +00:00
Previous commit failed for types with an extended exponent range - use logarithms rather than assuming the result is zero.
[SVN r86346]
This commit is contained in:
@@ -50,11 +50,8 @@ struct sph_bessel_j_small_z_series_term
|
||||
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());
|
||||
|
||||
Reference in New Issue
Block a user