Skip to content

Commit 0d6ff71

Browse files
committed
Incomplete Gamma: Restore previous overflow check
1 parent 5a30520 commit 0d6ff71

File tree

1 file changed

+2
-11
lines changed
  • include/boost/math/special_functions

1 file changed

+2
-11
lines changed

include/boost/math/special_functions/gamma.hpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,22 +1657,13 @@ BOOST_MATH_GPU_ENABLED T gamma_incomplete_imp_final(T a, T x, bool normalised, b
16571657
}
16581658
if(p_derivative)
16591659
{
1660-
/*
1661-
* We can never reach this:
1662-
if((x < 1) && (tools::max_value<T>() * x < *p_derivative))
1660+
if((x == 0) || ((x < 1) && (tools::max_value<T>() * x < *p_derivative)))
16631661
{
16641662
// overflow, just return an arbitrarily large value:
16651663
*p_derivative = tools::max_value<T>() / 2;
16661664
}
1667-
*/
1668-
BOOST_MATH_ASSERT((x >= 1) || (tools::max_value<T>() * x >= *p_derivative));
1669-
//
1670-
// Need to convert prefix term to derivative:
1671-
//
1672-
if (x > 0)
1665+
else
16731666
*p_derivative /= x;
1674-
else
1675-
*p_derivative = tools::max_value<T>() / 2;
16761667
}
16771668

16781669
return result;

0 commit comments

Comments
 (0)