diff --git a/include/boost/math/distributions/non_central_beta.hpp b/include/boost/math/distributions/non_central_beta.hpp index 9266c9e57..944f1dc24 100644 --- a/include/boost/math/distributions/non_central_beta.hpp +++ b/include/boost/math/distributions/non_central_beta.hpp @@ -212,7 +212,10 @@ namespace boost } pois *= i / l2; beta -= xterm; - xterm *= (a + i - 1) / (x * (a + b + i - 2)); + if (a + b + i - 2 != 0) + { + xterm *= (a + i - 1) / (x * (a + b + i - 2)); + } } return sum; }