2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

Replace casting of 0 to pointer type with nullptr

This commit is contained in:
Matt Borland
2022-07-10 18:05:13 -07:00
parent 7caa9101b0
commit f7f3b8e015
21 changed files with 152 additions and 152 deletions

View File

@@ -498,7 +498,7 @@ namespace boost
{
return 1;
}
return ibeta_inv(a, b, p, static_cast<RealType*>(0), Policy());
return ibeta_inv(a, b, p, static_cast<RealType*>(nullptr), Policy());
} // quantile
template <class RealType, class Policy>
@@ -535,7 +535,7 @@ namespace boost
return 1;
}
return ibetac_inv(a, b, q, static_cast<RealType*>(0), Policy());
return ibetac_inv(a, b, q, static_cast<RealType*>(nullptr), Policy());
} // Quantile Complement
} // namespace math

View File

@@ -335,8 +335,8 @@ namespace boost
// NOTE!!! The Clopper Pearson formula uses "successes" not
// "successes+1" as usual to get the lower bound,
// see http://www.itl.nist.gov/div898/handbook/prc/section2/prc241.htm
return (t == clopper_pearson_exact_interval) ? ibeta_inv(successes, trials - successes + 1, probability, static_cast<RealType*>(0), Policy())
: ibeta_inv(successes + 0.5f, trials - successes + 0.5f, probability, static_cast<RealType*>(0), Policy());
return (t == clopper_pearson_exact_interval) ? ibeta_inv(successes, trials - successes + 1, probability, static_cast<RealType*>(nullptr), Policy())
: ibeta_inv(successes + 0.5f, trials - successes + 0.5f, probability, static_cast<RealType*>(nullptr), Policy());
}
static RealType find_upper_bound_on_p(
RealType trials,
@@ -357,8 +357,8 @@ namespace boost
if(trials == successes)
return 1;
return (t == clopper_pearson_exact_interval) ? ibetac_inv(successes + 1, trials - successes, probability, static_cast<RealType*>(0), Policy())
: ibetac_inv(successes + 0.5f, trials - successes + 0.5f, probability, static_cast<RealType*>(0), Policy());
return (t == clopper_pearson_exact_interval) ? ibetac_inv(successes + 1, trials - successes, probability, static_cast<RealType*>(nullptr), Policy())
: ibetac_inv(successes + 0.5f, trials - successes + 0.5f, probability, static_cast<RealType*>(nullptr), Policy());
}
// Estimate number of trials parameter:
//

View File

@@ -65,7 +65,7 @@ inline typename Distribution::value_type hazard(const Distribution& dist, const
value_type d = pdf(dist, x);
if(d > p * tools::max_value<value_type>())
return policies::raise_overflow_error<value_type>(
"boost::math::hazard(const Distribution&, %1%)", 0, policy_type());
"boost::math::hazard(const Distribution&, %1%)", nullptr, policy_type());
if(d == 0)
{
// This protects against 0/0, but is it the right thing to do?
@@ -94,7 +94,7 @@ inline typename Distribution::value_type coefficient_of_variation(const Distribu
value_type d = standard_deviation(dist);
if((abs(m) < 1) && (d > abs(m) * tools::max_value<value_type>()))
{ // Checks too that m is not zero,
return policies::raise_overflow_error<value_type>("boost::math::coefficient_of_variation(const Distribution&, %1%)", 0, policy_type());
return policies::raise_overflow_error<value_type>("boost::math::coefficient_of_variation(const Distribution&, %1%)", nullptr, policy_type());
}
return d / m; // so MSVC warning on zerodivide is spurious, and suppressed.
}

View File

@@ -158,7 +158,7 @@ namespace boost
// Discrete Distributions" Yong CAI and K. KRISHNAMOORTHY
// http://www.ucs.louisiana.edu/~kxk4695/Discrete_new.pdf
//
return ibeta_inv(successes, failures + 1, alpha, static_cast<RealType*>(0), Policy());
return ibeta_inv(successes, failures + 1, alpha, static_cast<RealType*>(nullptr), Policy());
} // find_lower_bound_on_p
static RealType find_upper_bound_on_p(
@@ -187,7 +187,7 @@ namespace boost
// Discrete Distributions" Yong CAI and K. Krishnamoorthy
// http://www.ucs.louisiana.edu/~kxk4695/Discrete_new.pdf
//
return ibetac_inv(successes, failures, alpha, static_cast<RealType*>(0), Policy());
return ibetac_inv(successes, failures, alpha, static_cast<RealType*>(nullptr), Policy());
} // find_upper_bound_on_p
// Estimate number of trials :
@@ -222,7 +222,7 @@ namespace boost
if(false == geometric_detail::check_dist_and_k(
function, p, k, &result, Policy())
&& detail::check_probability(function, alpha, &result, Policy()))
{
{
return result;
}
result = ibetac_inva(k + 1, p, alpha, Policy()); // returns n - k
@@ -270,7 +270,7 @@ namespace boost
BOOST_MATH_STD_USING // ADL of std functions.
return 0;
} // mode
template <class RealType, class Policy>
inline RealType variance(const geometric_distribution<RealType, Policy>& dist)
{ // Variance of Binomial distribution = (1-p) / p^2.
@@ -446,7 +446,7 @@ namespace boost
{
return 0;
}
// log(1-x) /log(1-success_fraction) -1; but use log1p in case success_fraction is small
result = boost::math::log1p(-x, Policy()) / boost::math::log1p(-success_fraction, Policy()) - 1;
// Subtract a few epsilons here too?

View File

@@ -176,7 +176,7 @@ namespace boost
// Discrete Distributions" Yong CAI and K. KRISHNAMOORTHY
// http://www.ucs.louisiana.edu/~kxk4695/Discrete_new.pdf
//
return ibeta_inv(successes, failures + 1, alpha, static_cast<RealType*>(0), Policy());
return ibeta_inv(successes, failures + 1, alpha, static_cast<RealType*>(nullptr), Policy());
} // find_lower_bound_on_p
static RealType find_upper_bound_on_p(
@@ -204,7 +204,7 @@ namespace boost
// Discrete Distributions" Yong CAI and K. KRISHNAMOORTHY
// http://www.ucs.louisiana.edu/~kxk4695/Discrete_new.pdf
//
return ibetac_inv(successes, failures, alpha, static_cast<RealType*>(0), Policy());
return ibetac_inv(successes, failures, alpha, static_cast<RealType*>(nullptr), Policy());
} // find_upper_bound_on_p
// Estimate number of trials :

View File

@@ -756,7 +756,7 @@ inline bool check_overflow(T val, R* result, const char* function, const Policy&
BOOST_MATH_STD_USING
if(fabs(val) > tools::max_value<R>())
{
boost::math::policies::detail::raise_overflow_error<R>(function, 0, pol);
boost::math::policies::detail::raise_overflow_error<R>(function, nullptr, pol);
*result = static_cast<R>(val);
return true;
}
@@ -777,7 +777,7 @@ inline bool check_underflow(T val, R* result, const char* function, const Policy
{
if((val != 0) && (static_cast<R>(val) == 0))
{
*result = static_cast<R>(boost::math::policies::detail::raise_underflow_error<R>(function, 0, pol));
*result = static_cast<R>(boost::math::policies::detail::raise_underflow_error<R>(function, nullptr, pol));
return true;
}
return false;

View File

@@ -1467,7 +1467,7 @@ inline typename tools::promote_args<RT1, RT2, A>::type
beta(RT1 a, RT2 b, A arg)
{
typedef typename policies::is_policy<A>::type tag;
return boost::math::detail::beta(a, b, arg, static_cast<tag*>(0));
return boost::math::detail::beta(a, b, arg, static_cast<tag*>(nullptr));
}
template <class RT1, class RT2>

View File

@@ -122,7 +122,7 @@ T bessel_jn(int n, T x, const Policy& pol)
value *= factor;
if(tools::max_value<T>() * scale < fabs(value))
return policies::raise_overflow_error<T>("boost::math::bessel_jn<%1%>(%1%,%1%)", 0, pol);
return policies::raise_overflow_error<T>("boost::math::bessel_jn<%1%>(%1%,%1%)", nullptr, pol);
return value / scale;
}

View File

@@ -15,7 +15,7 @@
#include <type_traits>
namespace boost{ namespace math{
namespace boost{ namespace math{
namespace detail{
//
@@ -28,7 +28,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
BOOST_MATH_STD_USING // for ADL of std names.
T result = 0;
if(p <= 0.5)
{
//
@@ -44,7 +44,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
// Maximum Deviation Found (actual error term at infinite precision) 8.030e-21
//
static const float Y = 0.0891314744949340820313f;
static const T P[] = {
static const T P[] = {
BOOST_MATH_BIG_CONSTANT(T, 64, -0.000508781949658280665617),
BOOST_MATH_BIG_CONSTANT(T, 64, -0.00836874819741736770379),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.0334806625409744615033),
@@ -54,7 +54,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
BOOST_MATH_BIG_CONSTANT(T, 64, 0.00822687874676915743155),
BOOST_MATH_BIG_CONSTANT(T, 64, -0.00538772965071242932965)
};
static const T Q[] = {
static const T Q[] = {
BOOST_MATH_BIG_CONSTANT(T, 64, 1.0),
BOOST_MATH_BIG_CONSTANT(T, 64, -0.970005043303290640362),
BOOST_MATH_BIG_CONSTANT(T, 64, -1.56574558234175846809),
@@ -85,7 +85,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
// Maximum Deviation Found (error term) 4.811e-20
//
static const float Y = 2.249481201171875f;
static const T P[] = {
static const T P[] = {
BOOST_MATH_BIG_CONSTANT(T, 64, -0.202433508355938759655),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.105264680699391713268),
BOOST_MATH_BIG_CONSTANT(T, 64, 8.37050328343119927838),
@@ -96,7 +96,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
BOOST_MATH_BIG_CONSTANT(T, 64, 21.1294655448340526258),
BOOST_MATH_BIG_CONSTANT(T, 64, -3.67192254707729348546)
};
static const T Q[] = {
static const T Q[] = {
BOOST_MATH_BIG_CONSTANT(T, 64, 1.0),
BOOST_MATH_BIG_CONSTANT(T, 64, 6.24264124854247537712),
BOOST_MATH_BIG_CONSTANT(T, 64, 3.9713437953343869095),
@@ -124,7 +124,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
//
// x(Y+R(x-B))
//
// where Y is a constant, B is the lowest value of x for which
// where Y is a constant, B is the lowest value of x for which
// the approximation is valid, and R(x-B) is optimised for a low
// absolute error compared to Y.
//
@@ -138,7 +138,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
{
// Max error found: 1.089051e-20
static const float Y = 0.807220458984375f;
static const T P[] = {
static const T P[] = {
BOOST_MATH_BIG_CONSTANT(T, 64, -0.131102781679951906451),
BOOST_MATH_BIG_CONSTANT(T, 64, -0.163794047193317060787),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.117030156341995252019),
@@ -151,7 +151,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
BOOST_MATH_BIG_CONSTANT(T, 64, 0.285225331782217055858e-7),
BOOST_MATH_BIG_CONSTANT(T, 64, -0.681149956853776992068e-9)
};
static const T Q[] = {
static const T Q[] = {
BOOST_MATH_BIG_CONSTANT(T, 64, 1.0),
BOOST_MATH_BIG_CONSTANT(T, 64, 3.46625407242567245975),
BOOST_MATH_BIG_CONSTANT(T, 64, 5.38168345707006855425),
@@ -169,7 +169,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
{
// Max error found: 8.389174e-21
static const float Y = 0.93995571136474609375f;
static const T P[] = {
static const T P[] = {
BOOST_MATH_BIG_CONSTANT(T, 64, -0.0350353787183177984712),
BOOST_MATH_BIG_CONSTANT(T, 64, -0.00222426529213447927281),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.0185573306514231072324),
@@ -180,7 +180,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
BOOST_MATH_BIG_CONSTANT(T, 64, -0.230404776911882601748e-9),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.266339227425782031962e-11)
};
static const T Q[] = {
static const T Q[] = {
BOOST_MATH_BIG_CONSTANT(T, 64, 1.0),
BOOST_MATH_BIG_CONSTANT(T, 64, 1.3653349817554063097),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.762059164553623404043),
@@ -197,7 +197,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
{
// Max error found: 1.481312e-19
static const float Y = 0.98362827301025390625f;
static const T P[] = {
static const T P[] = {
BOOST_MATH_BIG_CONSTANT(T, 64, -0.0167431005076633737133),
BOOST_MATH_BIG_CONSTANT(T, 64, -0.00112951438745580278863),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.00105628862152492910091),
@@ -208,7 +208,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
BOOST_MATH_BIG_CONSTANT(T, 64, -0.281128735628831791805e-13),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.99055709973310326855e-16)
};
static const T Q[] = {
static const T Q[] = {
BOOST_MATH_BIG_CONSTANT(T, 64, 1.0),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.591429344886417493481),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.138151865749083321638),
@@ -225,7 +225,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
{
// Max error found: 5.697761e-20
static const float Y = 0.99714565277099609375f;
static const T P[] = {
static const T P[] = {
BOOST_MATH_BIG_CONSTANT(T, 64, -0.0024978212791898131227),
BOOST_MATH_BIG_CONSTANT(T, 64, -0.779190719229053954292e-5),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.254723037413027451751e-4),
@@ -235,7 +235,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
BOOST_MATH_BIG_CONSTANT(T, 64, 0.145596286718675035587e-11),
BOOST_MATH_BIG_CONSTANT(T, 64, -0.116765012397184275695e-17)
};
static const T Q[] = {
static const T Q[] = {
BOOST_MATH_BIG_CONSTANT(T, 64, 1.0),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.207123112214422517181),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.0169410838120975906478),
@@ -252,7 +252,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
{
// Max error found: 1.279746e-20
static const float Y = 0.99941349029541015625f;
static const T P[] = {
static const T P[] = {
BOOST_MATH_BIG_CONSTANT(T, 64, -0.000539042911019078575891),
BOOST_MATH_BIG_CONSTANT(T, 64, -0.28398759004727721098e-6),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.899465114892291446442e-6),
@@ -262,7 +262,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const std::integral_constan
BOOST_MATH_BIG_CONSTANT(T, 64, 0.135880130108924861008e-14),
BOOST_MATH_BIG_CONSTANT(T, 64, -0.348890393399948882918e-21)
};
static const T Q[] = {
static const T Q[] = {
BOOST_MATH_BIG_CONSTANT(T, 64, 1.0),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.0845746234001899436914),
BOOST_MATH_BIG_CONSTANT(T, 64, 0.00282092984726264681981),
@@ -301,7 +301,7 @@ T erf_inv_imp(const T& p, const T& q, const Policy& pol, const std::integral_con
//
// Generic version, get a guess that's accurate to 64-bits (10^-19)
//
T guess = erf_inv_imp(p, q, pol, static_cast<std::integral_constant<int, 64> const*>(0));
T guess = erf_inv_imp(p, q, pol, static_cast<std::integral_constant<int, 64> const*>(nullptr));
T result;
//
// If T has more bit's than 64 in it's mantissa then we need to iterate,
@@ -406,9 +406,9 @@ typename tools::promote_args<T>::type erfc_inv(T z, const Policy& pol)
if((z < 0) || (z > 2))
return policies::raise_domain_error<result_type>(function, "Argument outside range [0,2] in inverse erfc function (got p=%1%).", z, pol);
if(z == 0)
return policies::raise_overflow_error<result_type>(function, 0, pol);
return policies::raise_overflow_error<result_type>(function, nullptr, pol);
if(z == 2)
return -policies::raise_overflow_error<result_type>(function, 0, pol);
return -policies::raise_overflow_error<result_type>(function, nullptr, pol);
//
// Normalise the input, so it's in the range [0,1], we will
// negate the result if z is outside that range. This is a simple
@@ -442,9 +442,9 @@ typename tools::promote_args<T>::type erfc_inv(T z, const Policy& pol)
//
typedef typename policies::evaluation<result_type, Policy>::type eval_type;
typedef typename policies::normalise<
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
@@ -454,7 +454,7 @@ typename tools::promote_args<T>::type erfc_inv(T z, const Policy& pol)
// And get the result, negating where required:
//
return s * policies::checked_narrowing_cast<result_type, forwarding_policy>(
detail::erf_inv_imp(static_cast<eval_type>(p), static_cast<eval_type>(q), forwarding_policy(), static_cast<tag_type const*>(0)), function);
detail::erf_inv_imp(static_cast<eval_type>(p), static_cast<eval_type>(q), forwarding_policy(), static_cast<tag_type const*>(nullptr)), function);
}
template <class T, class Policy>
@@ -469,9 +469,9 @@ typename tools::promote_args<T>::type erf_inv(T z, const Policy& pol)
if((z < -1) || (z > 1))
return policies::raise_domain_error<result_type>(function, "Argument outside range [-1, 1] in inverse erf function (got p=%1%).", z, pol);
if(z == 1)
return policies::raise_overflow_error<result_type>(function, 0, pol);
return policies::raise_overflow_error<result_type>(function, nullptr, pol);
if(z == -1)
return -policies::raise_overflow_error<result_type>(function, 0, pol);
return -policies::raise_overflow_error<result_type>(function, nullptr, pol);
if(z == 0)
return 0;
//
@@ -507,9 +507,9 @@ typename tools::promote_args<T>::type erf_inv(T z, const Policy& pol)
//
typedef typename policies::evaluation<result_type, Policy>::type eval_type;
typedef typename policies::normalise<
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
//
@@ -523,7 +523,7 @@ typename tools::promote_args<T>::type erf_inv(T z, const Policy& pol)
// And get the result, negating where required:
//
return s * policies::checked_narrowing_cast<result_type, forwarding_policy>(
detail::erf_inv_imp(static_cast<eval_type>(p), static_cast<eval_type>(q), forwarding_policy(), static_cast<tag_type const*>(0)), function);
detail::erf_inv_imp(static_cast<eval_type>(p), static_cast<eval_type>(q), forwarding_policy(), static_cast<tag_type const*>(nullptr)), function);
}
template <class T>

View File

@@ -75,7 +75,7 @@ T gamma_inva_imp(const T& z, const T& p, const T& q, const Policy& pol)
//
if(p == 0)
{
return policies::raise_overflow_error<T>("boost::math::gamma_p_inva<%1%>(%1%, %1%)", 0, Policy());
return policies::raise_overflow_error<T>("boost::math::gamma_p_inva<%1%>(%1%, %1%)", nullptr, Policy());
}
if(q == 0)
{
@@ -91,7 +91,7 @@ T gamma_inva_imp(const T& z, const T& p, const T& q, const Policy& pol)
//
tools::eps_tolerance<T> tol(policies::digits<T, Policy>());
//
// Now figure out a starting guess for what a may be,
// Now figure out a starting guess for what a may be,
// we'll start out with a value that'll put p or q
// right bang in the middle of their range, the functions
// are quite sensitive so we should need too many steps
@@ -102,7 +102,7 @@ T gamma_inva_imp(const T& z, const T& p, const T& q, const Policy& pol)
if(z >= 1)
{
//
// We can use the relationship between the incomplete
// We can use the relationship between the incomplete
// gamma function and the poisson distribution to
// calculate an approximate inverse, for large z
// this is actually pretty accurate, but it fails badly
@@ -151,21 +151,21 @@ T gamma_inva_imp(const T& z, const T& p, const T& q, const Policy& pol)
} // namespace detail
template <class T1, class T2, class Policy>
inline typename tools::promote_args<T1, T2>::type
inline typename tools::promote_args<T1, T2>::type
gamma_p_inva(T1 x, T2 p, const Policy& pol)
{
typedef typename tools::promote_args<T1, T2>::type result_type;
typedef typename policies::evaluation<result_type, Policy>::type value_type;
typedef typename policies::normalise<
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
if(p == 0)
{
policies::raise_overflow_error<result_type>("boost::math::gamma_p_inva<%1%>(%1%, %1%)", 0, Policy());
policies::raise_overflow_error<result_type>("boost::math::gamma_p_inva<%1%>(%1%, %1%)", nullptr, Policy());
}
if(p == 1)
{
@@ -174,28 +174,28 @@ inline typename tools::promote_args<T1, T2>::type
return policies::checked_narrowing_cast<result_type, forwarding_policy>(
detail::gamma_inva_imp(
static_cast<value_type>(x),
static_cast<value_type>(p),
static_cast<value_type>(1 - static_cast<value_type>(p)),
static_cast<value_type>(x),
static_cast<value_type>(p),
static_cast<value_type>(1 - static_cast<value_type>(p)),
pol), "boost::math::gamma_p_inva<%1%>(%1%, %1%)");
}
template <class T1, class T2, class Policy>
inline typename tools::promote_args<T1, T2>::type
inline typename tools::promote_args<T1, T2>::type
gamma_q_inva(T1 x, T2 q, const Policy& pol)
{
typedef typename tools::promote_args<T1, T2>::type result_type;
typedef typename policies::evaluation<result_type, Policy>::type value_type;
typedef typename policies::normalise<
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
if(q == 1)
{
policies::raise_overflow_error<result_type>("boost::math::gamma_q_inva<%1%>(%1%, %1%)", 0, Policy());
policies::raise_overflow_error<result_type>("boost::math::gamma_q_inva<%1%>(%1%, %1%)", nullptr, Policy());
}
if(q == 0)
{
@@ -204,14 +204,14 @@ inline typename tools::promote_args<T1, T2>::type
return policies::checked_narrowing_cast<result_type, forwarding_policy>(
detail::gamma_inva_imp(
static_cast<value_type>(x),
static_cast<value_type>(1 - static_cast<value_type>(q)),
static_cast<value_type>(q),
static_cast<value_type>(x),
static_cast<value_type>(1 - static_cast<value_type>(q)),
static_cast<value_type>(q),
pol), "boost::math::gamma_q_inva<%1%>(%1%, %1%)");
}
template <class T1, class T2>
inline typename tools::promote_args<T1, T2>::type
inline typename tools::promote_args<T1, T2>::type
gamma_p_inva(T1 x, T2 p)
{
return boost::math::gamma_p_inva(x, p, policies::policy<>());

View File

@@ -421,7 +421,7 @@ struct ibeta_roots
BOOST_MATH_STD_USING // ADL of std names
BOOST_FPU_EXCEPTION_GUARD
T f1;
T y = 1 - x;
T f = ibeta_imp(a, b, x, Policy(), invert, true, &f1) - target;
@@ -491,7 +491,7 @@ T ibeta_inv_imp(T a, T b, T p, T q, const Policy& pol, T* py)
T x = 0; // Set to a safe zero to avoid a
// MSVC 2005 warning C4701: potentially uninitialized local variable 'x' used
// But code inspection appears to ensure that x IS assigned whatever the code path.
T y;
T y;
// For some of the methods we can put tighter bounds
// on the result than simply [0,1]:
@@ -638,7 +638,7 @@ T ibeta_inv_imp(T a, T b, T p, T q, const Policy& pol, T* py)
y = pow(b * q * bet, 1/b);
x = 1 - y;
}
else
else
y = 1;
if(y > 1e-5)
{
@@ -869,7 +869,7 @@ T ibeta_inv_imp(T a, T b, T p, T q, const Policy& pol, T* py)
// thrash around and convergence may be slow in this case.
// Try 3/4 of machine epsilon:
//
digits *= 3;
digits *= 3;
digits /= 2;
}
//
@@ -899,7 +899,7 @@ T ibeta_inv_imp(T a, T b, T p, T q, const Policy& pol, T* py)
} // namespace detail
template <class T1, class T2, class T3, class T4, class Policy>
inline typename tools::promote_args<T1, T2, T3, T4>::type
inline typename tools::promote_args<T1, T2, T3, T4>::type
ibeta_inv(T1 a, T2 b, T3 p, T4* py, const Policy& pol)
{
static const char* function = "boost::math::ibeta_inv<%1%>(%1%,%1%,%1%)";
@@ -907,9 +907,9 @@ inline typename tools::promote_args<T1, T2, T3, T4>::type
typedef typename tools::promote_args<T1, T2, T3, T4>::type result_type;
typedef typename policies::evaluation<result_type, Policy>::type value_type;
typedef typename policies::normalise<
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
@@ -934,30 +934,30 @@ inline typename tools::promote_args<T1, T2, T3, T4>::type
}
template <class T1, class T2, class T3, class T4>
inline typename tools::promote_args<T1, T2, T3, T4>::type
inline typename tools::promote_args<T1, T2, T3, T4>::type
ibeta_inv(T1 a, T2 b, T3 p, T4* py)
{
return ibeta_inv(a, b, p, py, policies::policy<>());
}
template <class T1, class T2, class T3>
inline typename tools::promote_args<T1, T2, T3>::type
inline typename tools::promote_args<T1, T2, T3>::type
ibeta_inv(T1 a, T2 b, T3 p)
{
typedef typename tools::promote_args<T1, T2, T3>::type result_type;
return ibeta_inv(a, b, p, static_cast<result_type*>(0), policies::policy<>());
return ibeta_inv(a, b, p, static_cast<result_type*>(nullptr), policies::policy<>());
}
template <class T1, class T2, class T3, class Policy>
inline typename tools::promote_args<T1, T2, T3>::type
inline typename tools::promote_args<T1, T2, T3>::type
ibeta_inv(T1 a, T2 b, T3 p, const Policy& pol)
{
typedef typename tools::promote_args<T1, T2, T3>::type result_type;
return ibeta_inv(a, b, p, static_cast<result_type*>(0), pol);
return ibeta_inv(a, b, p, static_cast<result_type*>(nullptr), pol);
}
template <class T1, class T2, class T3, class T4, class Policy>
inline typename tools::promote_args<T1, T2, T3, T4>::type
inline typename tools::promote_args<T1, T2, T3, T4>::type
ibetac_inv(T1 a, T2 b, T3 q, T4* py, const Policy& pol)
{
static const char* function = "boost::math::ibetac_inv<%1%>(%1%,%1%,%1%)";
@@ -965,9 +965,9 @@ inline typename tools::promote_args<T1, T2, T3, T4>::type
typedef typename tools::promote_args<T1, T2, T3, T4>::type result_type;
typedef typename policies::evaluation<result_type, Policy>::type value_type;
typedef typename policies::normalise<
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
@@ -992,18 +992,18 @@ inline typename tools::promote_args<T1, T2, T3, T4>::type
}
template <class T1, class T2, class T3, class T4>
inline typename tools::promote_args<T1, T2, T3, T4>::type
inline typename tools::promote_args<T1, T2, T3, T4>::type
ibetac_inv(T1 a, T2 b, T3 q, T4* py)
{
return ibetac_inv(a, b, q, py, policies::policy<>());
}
template <class RT1, class RT2, class RT3>
inline typename tools::promote_args<RT1, RT2, RT3>::type
inline typename tools::promote_args<RT1, RT2, RT3>::type
ibetac_inv(RT1 a, RT2 b, RT3 q)
{
typedef typename tools::promote_args<RT1, RT2, RT3>::type result_type;
return ibetac_inv(a, b, q, static_cast<result_type*>(0), policies::policy<>());
return ibetac_inv(a, b, q, static_cast<result_type*>(nullptr), policies::policy<>());
}
template <class RT1, class RT2, class RT3, class Policy>
@@ -1011,7 +1011,7 @@ inline typename tools::promote_args<RT1, RT2, RT3>::type
ibetac_inv(RT1 a, RT2 b, RT3 q, const Policy& pol)
{
typedef typename tools::promote_args<RT1, RT2, RT3>::type result_type;
return ibetac_inv(a, b, q, static_cast<result_type*>(0), pol);
return ibetac_inv(a, b, q, static_cast<result_type*>(nullptr), pol);
}
} // namespace math

View File

@@ -146,37 +146,37 @@ T inverse_students_t_body_series(T df, T u, const Policy& pol)
T in = 1 / df;
c[2] = static_cast<T>(0.16666666666666666667 + 0.16666666666666666667 * in);
c[3] = static_cast<T>((0.0083333333333333333333 * in
+ 0.066666666666666666667) * in
+ 0.066666666666666666667) * in
+ 0.058333333333333333333);
c[4] = static_cast<T>(((0.00019841269841269841270 * in
+ 0.0017857142857142857143) * in
+ 0.026785714285714285714) * in
+ 0.0017857142857142857143) * in
+ 0.026785714285714285714) * in
+ 0.025198412698412698413);
c[5] = static_cast<T>((((2.7557319223985890653e-6 * in
+ 0.00037477954144620811287) * in
- 0.0011078042328042328042) * in
+ 0.010559964726631393298) * in
+ 0.00037477954144620811287) * in
- 0.0011078042328042328042) * in
+ 0.010559964726631393298) * in
+ 0.012039792768959435626);
c[6] = static_cast<T>(((((2.5052108385441718775e-8 * in
- 0.000062705427288760622094) * in
+ 0.00059458674042007375341) * in
- 0.0016095979637646304313) * in
+ 0.0061039211560044893378) * in
- 0.000062705427288760622094) * in
+ 0.00059458674042007375341) * in
- 0.0016095979637646304313) * in
+ 0.0061039211560044893378) * in
+ 0.0038370059724226390893);
c[7] = static_cast<T>((((((1.6059043836821614599e-10 * in
+ 0.000015401265401265401265) * in
+ 0.000015401265401265401265) * in
- 0.00016376804137220803887) * in
+ 0.00069084207973096861986) * in
- 0.0012579159844784844785) * in
+ 0.0010898206731540064873) * in
+ 0.00069084207973096861986) * in
- 0.0012579159844784844785) * in
+ 0.0010898206731540064873) * in
+ 0.0032177478835464946576);
c[8] = static_cast<T>(((((((7.6471637318198164759e-13 * in
- 3.9851014346715404916e-6) * in
+ 0.000049255746366361445727) * in
- 0.00024947258047043099953) * in
- 0.00024947258047043099953) * in
+ 0.00064513046951456342991) * in
- 0.00076245135440323932387) * in
+ 0.000033530976880017885309) * in
+ 0.000033530976880017885309) * in
+ 0.0017438262298340009980);
c[9] = static_cast<T>((((((((2.8114572543455207632e-15 * in
+ 1.0914179173496789432e-6) * in
@@ -185,7 +185,7 @@ T inverse_students_t_body_series(T df, T u, const Policy& pol)
- 0.00029133414466938067350) * in
+ 0.00051406605788341121363) * in
- 0.00036307660358786885787) * in
- 0.00031101086326318780412) * in
- 0.00031101086326318780412) * in
+ 0.00096472747321388644237);
c[10] = static_cast<T>(((((((((8.2206352466243297170e-18 * in
- 3.1239569599829868045e-7) * in
@@ -438,7 +438,7 @@ inline T fast_students_t_quantile_imp(T df, T p, const Policy& pol, const std::f
T t, x, y(0);
x = ibeta_inv(df / 2, T(0.5), 2 * probability, &y, pol);
if(df * y > tools::max_value<T>() * x)
t = policies::raise_overflow_error<T>("boost::math::students_t_quantile<%1%>(%1%,%1%)", 0, pol);
t = policies::raise_overflow_error<T>("boost::math::students_t_quantile<%1%>(%1%,%1%)", nullptr, pol);
else
t = sqrt(df * y / x);
//
@@ -455,7 +455,7 @@ T fast_students_t_quantile_imp(T df, T p, const Policy& pol, const std::true_typ
BOOST_MATH_STD_USING
bool invert = false;
if((df < 2) && (floor(df) != df))
return boost::math::detail::fast_students_t_quantile_imp(df, p, pol, static_cast<std::false_type*>(0));
return boost::math::detail::fast_students_t_quantile_imp(df, p, pol, static_cast<std::false_type*>(nullptr));
if(p > 0.5)
{
p = 1 - p;
@@ -525,9 +525,9 @@ inline T fast_students_t_quantile(T df, T p, const Policy& pol)
{
typedef typename policies::evaluation<T, Policy>::type value_type;
typedef typename policies::normalise<
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
@@ -538,7 +538,7 @@ inline T fast_students_t_quantile(T df, T p, const Policy& pol)
&&
(std::numeric_limits<T>::radix == 2)
> tag_type;
return policies::checked_narrowing_cast<T, forwarding_policy>(fast_students_t_quantile_imp(static_cast<value_type>(df), static_cast<value_type>(p), pol, static_cast<tag_type*>(0)), "boost::math::students_t_quantile<%1%>(%1%,%1%,%1%)");
return policies::checked_narrowing_cast<T, forwarding_policy>(fast_students_t_quantile_imp(static_cast<value_type>(df), static_cast<value_type>(p), pol, static_cast<tag_type*>(nullptr)), "boost::math::students_t_quantile<%1%>(%1%,%1%,%1%)");
}
}}} // namespaces

View File

@@ -30,11 +30,11 @@
// Elliptic integrals (complete and incomplete) of the second kind
// Carlson, Numerische Mathematik, vol 33, 1 (1979)
namespace boost { namespace math {
namespace boost { namespace math {
template <class T1, class T2, class Policy>
typename tools::promote_args<T1, T2>::type ellint_2(T1 k, T2 phi, const Policy& pol);
namespace detail{
template <typename T, typename Policy>
@@ -63,7 +63,7 @@ T ellint_e_imp(T phi, T k, const Policy& pol)
if(phi >= tools::max_value<T>())
{
// Need to handle infinity as a special case:
result = policies::raise_overflow_error<T>("boost::math::ellint_e<%1%>(%1%,%1%)", 0, pol);
result = policies::raise_overflow_error<T>("boost::math::ellint_e<%1%>(%1%,%1%)", nullptr, pol);
}
else if(phi > 1 / tools::epsilon<T>())
{

View File

@@ -30,11 +30,11 @@
// Elliptic integrals (complete and incomplete) of the second kind
// Carlson, Numerische Mathematik, vol 33, 1 (1979)
namespace boost { namespace math {
namespace boost { namespace math {
template <class T1, class T2, class Policy>
typename tools::promote_args<T1, T2>::type ellint_d(T1 k, T2 phi, const Policy& pol);
namespace detail{
template <typename T, typename Policy>
@@ -60,7 +60,7 @@ T ellint_d_imp(T phi, T k, const Policy& pol)
if(phi >= tools::max_value<T>())
{
// Need to handle infinity as a special case:
result = policies::raise_overflow_error<T>("boost::math::ellint_d<%1%>(%1%,%1%)", 0, pol);
result = policies::raise_overflow_error<T>("boost::math::ellint_d<%1%>(%1%,%1%)", nullptr, pol);
}
else if(phi > 1 / tools::epsilon<T>())
{

View File

@@ -128,7 +128,7 @@ inline bool is_nan_helper(T, const std::false_type&)
{
return false;
}
#if defined(BOOST_MATH_USE_FLOAT128)
#if defined(BOOST_MATH_USE_FLOAT128)
#if defined(BOOST_MATH_HAS_QUADMATH_H)
inline bool is_nan_helper(__float128 f, const std::true_type&) { return ::isnanq(f); }
inline bool is_nan_helper(__float128 f, const std::false_type&) { return ::isnanq(f); }
@@ -279,7 +279,7 @@ inline int fpclassify BOOST_NO_MACRO_EXPAND(T t)
typedef typename traits::method method;
typedef typename tools::promote_args_permissive<T>::type value_type;
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
if(std::numeric_limits<T>::is_specialized && detail::is_generic_tag_false(static_cast<method*>(0)))
if(std::numeric_limits<T>::is_specialized && detail::is_generic_tag_false(static_cast<method*>(nullptr)))
return detail::fpclassify_imp(static_cast<value_type>(t), detail::generic_tag<true>());
return detail::fpclassify_imp(static_cast<value_type>(t), method());
#else
@@ -295,7 +295,7 @@ inline int fpclassify<long double> BOOST_NO_MACRO_EXPAND(long double t)
typedef traits::method method;
typedef long double value_type;
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
if(std::numeric_limits<long double>::is_specialized && detail::is_generic_tag_false(static_cast<method*>(0)))
if(std::numeric_limits<long double>::is_specialized && detail::is_generic_tag_false(static_cast<method*>(nullptr)))
return detail::fpclassify_imp(static_cast<value_type>(t), detail::generic_tag<true>());
return detail::fpclassify_imp(static_cast<value_type>(t), method());
#else

View File

@@ -709,7 +709,7 @@ T lgamma_imp(T z, const Policy& pol, const lanczos::undefined_lanczos&, int* sig
- log(t);
}
if(sign != static_cast<int*>(0U)) { *sign = sign_of_result; }
if(sign != static_cast<int*>(nullptr)) { *sign = sign_of_result; }
return log_gamma_value;
}
@@ -1218,7 +1218,7 @@ T gamma_incomplete_imp(T a, T x, bool normalised, bool invert,
return exp(result);
}
BOOST_MATH_ASSERT((p_derivative == 0) || normalised);
BOOST_MATH_ASSERT((p_derivative == nullptr) || normalised);
bool is_int, is_half_int;
bool is_small_a = (a < 30) && (a <= x + 1) && (x < tools::log_max_value<T>());
@@ -1450,7 +1450,7 @@ T gamma_incomplete_imp(T a, T x, bool normalised, bool invert,
precision_type::value <= 113 ? 113 : 0
> tag_type;
result = igamma_temme_large(a, x, pol, static_cast<tag_type const*>(0));
result = igamma_temme_large(a, x, pol, static_cast<tag_type const*>(nullptr));
if(x >= a)
invert = !invert;
if(p_derivative)
@@ -1787,7 +1787,7 @@ T gamma_p_derivative_imp(T a, T x, const Policy& pol)
if(x == 0)
{
return (a > 1) ? 0 :
(a == 1) ? 1 : policies::raise_overflow_error<T>("boost::math::gamma_p_derivative<%1%>(%1%, %1%)", 0, pol);
(a == 1) ? 1 : policies::raise_overflow_error<T>("boost::math::gamma_p_derivative<%1%>(%1%, %1%)", nullptr, pol);
}
//
// Normal case:
@@ -1797,7 +1797,7 @@ T gamma_p_derivative_imp(T a, T x, const Policy& pol)
if((x < 1) && (tools::max_value<T>() * x < f1))
{
// overflow:
return policies::raise_overflow_error<T>("boost::math::gamma_p_derivative<%1%>(%1%, %1%)", 0, pol);
return policies::raise_overflow_error<T>("boost::math::gamma_p_derivative<%1%>(%1%, %1%)", nullptr, pol);
}
if(f1 == 0)
{

View File

@@ -31,14 +31,14 @@ T hypot_imp(T x, T y, const Policy& pol)
y = fabs(y);
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(push)
#pragma warning(disable: 4127)
#endif
// special case, see C99 Annex F:
if(std::numeric_limits<T>::has_infinity
&& ((x == std::numeric_limits<T>::infinity())
|| (y == std::numeric_limits<T>::infinity())))
return policies::raise_overflow_error<T>("boost::math::hypot<%1%>(%1%,%1%)", 0, pol);
return policies::raise_overflow_error<T>("boost::math::hypot<%1%>(%1%,%1%)", nullptr, pol);
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@@ -56,7 +56,7 @@ T hypot_imp(T x, T y, const Policy& pol)
}
template <class T1, class T2>
inline typename tools::promote_args<T1, T2>::type
inline typename tools::promote_args<T1, T2>::type
hypot(T1 x, T2 y)
{
typedef typename tools::promote_args<T1, T2>::type result_type;
@@ -65,7 +65,7 @@ inline typename tools::promote_args<T1, T2>::type
}
template <class T1, class T2, class Policy>
inline typename tools::promote_args<T1, T2>::type
inline typename tools::promote_args<T1, T2>::type
hypot(T1 x, T2 y, const Policy& pol)
{
typedef typename tools::promote_args<T1, T2>::type result_type;

View File

@@ -123,9 +123,9 @@ inline typename tools::promote_args<T, U, V>::type jacobi_elliptic(T k, U theta,
typedef typename tools::promote_args<T>::type result_type;
typedef typename policies::evaluation<result_type, Policy>::type value_type;
typedef typename policies::normalise<
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
Policy,
policies::promote_float<false>,
policies::promote_double<false>,
policies::discrete_quantile<>,
policies::assert_undefined<> >::type forwarding_policy;
@@ -150,7 +150,7 @@ template <class U, class T, class Policy>
inline typename tools::promote_args<T, U>::type jacobi_sn(U k, T theta, const Policy& pol)
{
typedef typename tools::promote_args<T, U>::type result_type;
return jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), static_cast<result_type*>(0), static_cast<result_type*>(0), pol);
return jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), static_cast<result_type*>(nullptr), static_cast<result_type*>(nullptr), pol);
}
template <class U, class T>
@@ -164,7 +164,7 @@ inline typename tools::promote_args<T, U>::type jacobi_cn(T k, U theta, const Po
{
typedef typename tools::promote_args<T, U>::type result_type;
result_type cn;
jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), &cn, static_cast<result_type*>(0), pol);
jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), &cn, static_cast<result_type*>(nullptr), pol);
return cn;
}
@@ -179,7 +179,7 @@ inline typename tools::promote_args<T, U>::type jacobi_dn(T k, U theta, const Po
{
typedef typename tools::promote_args<T, U>::type result_type;
result_type dn;
jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), static_cast<result_type*>(0), &dn, pol);
jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), static_cast<result_type*>(nullptr), &dn, pol);
return dn;
}
@@ -223,7 +223,7 @@ template <class T, class U, class Policy>
inline typename tools::promote_args<T, U>::type jacobi_ns(T k, U theta, const Policy& pol)
{
typedef typename tools::promote_args<T, U>::type result_type;
return 1 / jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), static_cast<result_type*>(0), static_cast<result_type*>(0), pol);
return 1 / jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), static_cast<result_type*>(nullptr), static_cast<result_type*>(nullptr), pol);
}
template <class T, class U>
@@ -237,7 +237,7 @@ inline typename tools::promote_args<T, U>::type jacobi_sd(T k, U theta, const Po
{
typedef typename tools::promote_args<T, U>::type result_type;
result_type sn, dn;
sn = jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), static_cast<result_type*>(0), &dn, pol);
sn = jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), static_cast<result_type*>(nullptr), &dn, pol);
return sn / dn;
}
@@ -252,7 +252,7 @@ inline typename tools::promote_args<T, U>::type jacobi_ds(T k, U theta, const Po
{
typedef typename tools::promote_args<T, U>::type result_type;
result_type sn, dn;
sn = jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), static_cast<result_type*>(0), &dn, pol);
sn = jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), static_cast<result_type*>(nullptr), &dn, pol);
return dn / sn;
}
@@ -291,7 +291,7 @@ inline typename tools::promote_args<T, U>::type jacobi_sc(T k, U theta, const Po
{
typedef typename tools::promote_args<T, U>::type result_type;
result_type sn, cn;
sn = jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), &cn, static_cast<result_type*>(0), pol);
sn = jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), &cn, static_cast<result_type*>(nullptr), pol);
return sn / cn;
}
@@ -306,7 +306,7 @@ inline typename tools::promote_args<T, U>::type jacobi_cs(T k, U theta, const Po
{
typedef typename tools::promote_args<T, U>::type result_type;
result_type sn, cn;
sn = jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), &cn, static_cast<result_type*>(0), pol);
sn = jacobi_elliptic(static_cast<result_type>(k), static_cast<result_type>(theta), &cn, static_cast<result_type*>(nullptr), pol);
return cn / sn;
}

View File

@@ -91,7 +91,7 @@ T log1p_imp(T const & x, const Policy& pol, const std::integral_constant<int, 0>
function, "log1p(x) requires x > -1, but got x = %1%.", x, pol);
if(x == -1)
return -policies::raise_overflow_error<T>(
function, 0, pol);
function, nullptr, pol);
result_type a = abs(result_type(x));
if(a > result_type(0.5f))
@@ -121,7 +121,7 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant<int, 53>
function, "log1p(x) requires x > -1, but got x = %1%.", x, pol);
if(x == -1)
return -policies::raise_overflow_error<T>(
function, 0, pol);
function, nullptr, pol);
T a = fabs(x);
if(a > 0.5f)
@@ -174,7 +174,7 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant<int, 64>
function, "log1p(x) requires x > -1, but got x = %1%.", x, pol);
if(x == -1)
return -policies::raise_overflow_error<T>(
function, 0, pol);
function, nullptr, pol);
T a = fabs(x);
if(a > 0.5f)
@@ -229,7 +229,7 @@ T log1p_imp(T const& x, const Policy& pol, const std::integral_constant<int, 24>
function, "log1p(x) requires x > -1, but got x = %1%.", x, pol);
if(x == -1)
return -policies::raise_overflow_error<T>(
function, 0, pol);
function, nullptr, pol);
T a = fabs(x);
if(a > 0.5f)
@@ -445,7 +445,7 @@ inline typename tools::promote_args<T>::type
function, "log1pmx(x) requires x > -1, but got x = %1%.", x, pol);
if(x == -1)
return -policies::raise_overflow_error<T>(
function, 0, pol);
function, nullptr, pol);
result_type a = abs(result_type(x));
if(a > result_type(0.95f))

View File

@@ -302,7 +302,7 @@ inline double float_next(const double& val, const Policy& pol)
"Argument must be finite, but got %1%", val, pol);
if(val >= tools::max_value<double>())
return policies::raise_overflow_error<double>(function, 0, pol);
return policies::raise_overflow_error<double>(function, nullptr, pol);
return ::_nextafter(val, tools::max_value<double>());
}
@@ -438,7 +438,7 @@ inline double float_prior(const double& val, const Policy& pol)
"Argument must be finite, but got %1%", val, pol);
if(val <= -tools::max_value<double>())
return -policies::raise_overflow_error<double>(function, 0, pol);
return -policies::raise_overflow_error<double>(function, nullptr, pol);
return ::_nextafter(val, -tools::max_value<double>());
}

View File

@@ -304,7 +304,7 @@ void test_check_throw(Val v, boost::math::rounding_error const*)
// but to keep things simple we really need it somewhere that's always included:
//
#ifdef BOOST_NO_EXCEPTIONS
# define BOOST_MATH_CHECK_THROW(x, ExceptionType) boost::math::tools::test_check_throw(x, static_cast<ExceptionType const*>(0));
# define BOOST_MATH_CHECK_THROW(x, ExceptionType) boost::math::tools::test_check_throw(x, static_cast<ExceptionType const*>(nullptr));
#else
# define BOOST_MATH_CHECK_THROW(x, y) BOOST_CHECK_THROW(x, y)
#endif