diff --git a/include/boost/math/special_functions/beta.hpp b/include/boost/math/special_functions/beta.hpp index ec824daf72..8121c1622d 100644 --- a/include/boost/math/special_functions/beta.hpp +++ b/include/boost/math/special_functions/beta.hpp @@ -1021,18 +1021,15 @@ T ibeta_imp(T a, T b, T x, const Policy& pol, bool inv, bool normalised, T* p_de BOOST_MATH_ASSERT((p_derivative == 0) || normalised); if(!(boost::math::isfinite)(a)) - return policies::raise_domain_error(function, "The argument a to the incomplete beta function must be >= zero (got a=%1%).", a, pol); + return policies::raise_domain_error(function, "The argument a to the incomplete beta function must be finite (got a=%1%).", a, pol); if(!(boost::math::isfinite)(b)) - return policies::raise_domain_error(function, "The argument b to the incomplete beta function must be >= zero (got b=%1%).", b, pol); - if(!(boost::math::isfinite)(x)) + return policies::raise_domain_error(function, "The argument b to the incomplete beta function must be finite (got b=%1%).", b, pol); + if (!(0 <= x && x <= 1)) return policies::raise_domain_error(function, "The argument x to the incomplete beta function must be in [0,1] (got x=%1%).", x, pol); if(p_derivative) *p_derivative = -1; // value not set. - if((x < 0) || (x > 1)) - return policies::raise_domain_error(function, "Parameter x outside the range [0,1] in the incomplete beta function (got x=%1%).", x, pol); - if(normalised) { if(a < 0) @@ -1422,18 +1419,16 @@ T ibeta_derivative_imp(T a, T b, T x, const Policy& pol) // start with the usual error checks: // if (!(boost::math::isfinite)(a)) - return policies::raise_domain_error(function, "The argument a to the incomplete beta function must be >= zero (got a=%1%).", a, pol); + return policies::raise_domain_error(function, "The argument a to the incomplete beta function must be finite (got a=%1%).", a, pol); if (!(boost::math::isfinite)(b)) - return policies::raise_domain_error(function, "The argument b to the incomplete beta function must be >= zero (got b=%1%).", b, pol); - if (!(boost::math::isfinite)(x)) + return policies::raise_domain_error(function, "The argument b to the incomplete beta function must be finite (got b=%1%).", b, pol); + if (!(0 <= x && x <= 1)) return policies::raise_domain_error(function, "The argument x to the incomplete beta function must be in [0,1] (got x=%1%).", x, pol); if(a <= 0) return policies::raise_domain_error(function, "The argument a to the incomplete beta function must be greater than zero (got a=%1%).", a, pol); if(b <= 0) return policies::raise_domain_error(function, "The argument b to the incomplete beta function must be greater than zero (got b=%1%).", b, pol); - if((x < 0) || (x > 1)) - return policies::raise_domain_error(function, "Parameter x outside the range [0,1] in the incomplete beta function (got x=%1%).", x, pol); // // Now the corner cases: //