summaryrefslogtreecommitdiff
path: root/boost/math/special_functions/detail/ibeta_inv_ab.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/math/special_functions/detail/ibeta_inv_ab.hpp')
-rw-r--r--boost/math/special_functions/detail/ibeta_inv_ab.hpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/boost/math/special_functions/detail/ibeta_inv_ab.hpp b/boost/math/special_functions/detail/ibeta_inv_ab.hpp
index 8318a28454..f5735a8495 100644
--- a/boost/math/special_functions/detail/ibeta_inv_ab.hpp
+++ b/boost/math/special_functions/detail/ibeta_inv_ab.hpp
@@ -153,7 +153,7 @@ T ibeta_inv_ab_imp(const T& b, const T& z, const T& p, const T& q, bool swap_ab,
boost::uintmax_t max_iter = policies::get_max_root_iterations<Policy>();
std::pair<T, T> r = bracket_and_solve_root(f, guess, factor, swap_ab ? true : false, tol, max_iter, pol);
if(max_iter >= policies::get_max_root_iterations<Policy>())
- policies::raise_evaluation_error<T>("boost::math::ibeta_invab_imp<%1%>(%1%,%1%,%1%)", "Unable to locate the root within a reasonable number of iterations, closest approximation so far was %1%", r.first, pol);
+ return policies::raise_evaluation_error<T>("boost::math::ibeta_invab_imp<%1%>(%1%,%1%,%1%)", "Unable to locate the root within a reasonable number of iterations, closest approximation so far was %1%", r.first, pol);
return (r.first + r.second) / 2;
}
@@ -172,9 +172,10 @@ typename tools::promote_args<RT1, RT2, RT3>::type
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
+ static const char* function = "boost::math::ibeta_inva<%1%>(%1%,%1%,%1%)";
if(p == 0)
{
- return tools::max_value<result_type>();
+ return policies::raise_overflow_error<result_type>(function, 0, Policy());
}
if(p == 1)
{
@@ -188,7 +189,7 @@ typename tools::promote_args<RT1, RT2, RT3>::type
static_cast<value_type>(p),
static_cast<value_type>(1 - static_cast<value_type>(p)),
false, pol),
- "boost::math::ibeta_inva<%1%>(%1%,%1%,%1%)");
+ function);
}
template <class RT1, class RT2, class RT3, class Policy>
@@ -204,9 +205,10 @@ typename tools::promote_args<RT1, RT2, RT3>::type
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
+ static const char* function = "boost::math::ibetac_inva<%1%>(%1%,%1%,%1%)";
if(q == 1)
{
- return tools::max_value<result_type>();
+ return policies::raise_overflow_error<result_type>(function, 0, Policy());
}
if(q == 0)
{
@@ -220,7 +222,7 @@ typename tools::promote_args<RT1, RT2, RT3>::type
static_cast<value_type>(1 - static_cast<value_type>(q)),
static_cast<value_type>(q),
false, pol),
- "boost::math::ibetac_inva<%1%>(%1%,%1%,%1%)");
+ function);
}
template <class RT1, class RT2, class RT3, class Policy>
@@ -236,13 +238,14 @@ typename tools::promote_args<RT1, RT2, RT3>::type
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
+ static const char* function = "boost::math::ibeta_invb<%1%>(%1%,%1%,%1%)";
if(p == 0)
{
return tools::min_value<result_type>();
}
if(p == 1)
{
- return tools::max_value<result_type>();
+ return policies::raise_overflow_error<result_type>(function, 0, Policy());
}
return policies::checked_narrowing_cast<result_type, forwarding_policy>(
@@ -252,13 +255,14 @@ typename tools::promote_args<RT1, RT2, RT3>::type
static_cast<value_type>(p),
static_cast<value_type>(1 - static_cast<value_type>(p)),
true, pol),
- "boost::math::ibeta_invb<%1%>(%1%,%1%,%1%)");
+ function);
}
template <class RT1, class RT2, class RT3, class Policy>
typename tools::promote_args<RT1, RT2, RT3>::type
ibetac_invb(RT1 a, RT2 x, RT3 q, const Policy& pol)
{
+ static const char* function = "boost::math::ibeta_invb<%1%>(%1%, %1%, %1%)";
typedef typename tools::promote_args<RT1, RT2, RT3>::type result_type;
typedef typename policies::evaluation<result_type, Policy>::type value_type;
typedef typename policies::normalise<
@@ -274,7 +278,7 @@ typename tools::promote_args<RT1, RT2, RT3>::type
}
if(q == 0)
{
- return tools::max_value<result_type>();
+ return policies::raise_overflow_error<result_type>(function, 0, Policy());
}
return policies::checked_narrowing_cast<result_type, forwarding_policy>(
@@ -282,9 +286,9 @@ typename tools::promote_args<RT1, RT2, RT3>::type
static_cast<value_type>(a),
static_cast<value_type>(x),
static_cast<value_type>(1 - static_cast<value_type>(q)),
- static_cast<value_type>(q),
+ static_cast<value_type>(q),
true, pol),
- "boost::math::ibetac_invb<%1%>(%1%,%1%,%1%)");
+ function);
}
template <class RT1, class RT2, class RT3>