2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-28 07:22:12 +00:00

Suppress a whole bunch of new gcc-4.6 warnings.

Add code to verify that the radix of the type is 2 wherever that assumption is made.
Add some more instrumentation code.

[SVN r71672]
This commit is contained in:
John Maddock
2011-05-02 15:36:51 +00:00
parent d27407f320
commit a5239fa567
33 changed files with 312 additions and 209 deletions

View File

@@ -130,66 +130,118 @@ struct DistributionConcept
// The result values are ignored in all these checks.
value_type v = cdf(dist, x);
v = cdf(complement(dist, x));
suppress_unused_variable_warning(v);
v = pdf(dist, x);
suppress_unused_variable_warning(v);
v = quantile(dist, x);
suppress_unused_variable_warning(v);
v = quantile(complement(dist, x));
suppress_unused_variable_warning(v);
v = mean(dist);
suppress_unused_variable_warning(v);
v = mode(dist);
suppress_unused_variable_warning(v);
v = standard_deviation(dist);
suppress_unused_variable_warning(v);
v = variance(dist);
suppress_unused_variable_warning(v);
v = hazard(dist, x);
suppress_unused_variable_warning(v);
v = chf(dist, x);
suppress_unused_variable_warning(v);
v = coefficient_of_variation(dist);
suppress_unused_variable_warning(v);
v = skewness(dist);
suppress_unused_variable_warning(v);
v = kurtosis(dist);
suppress_unused_variable_warning(v);
v = kurtosis_excess(dist);
suppress_unused_variable_warning(v);
v = median(dist);
suppress_unused_variable_warning(v);
std::pair<value_type, value_type> pv;
pv = range(dist);
suppress_unused_variable_warning(pv);
pv = support(dist);
suppress_unused_variable_warning(pv);
float f = 1;
v = cdf(dist, f);
suppress_unused_variable_warning(v);
v = cdf(complement(dist, f));
suppress_unused_variable_warning(v);
v = pdf(dist, f);
suppress_unused_variable_warning(v);
v = quantile(dist, f);
suppress_unused_variable_warning(v);
v = quantile(complement(dist, f));
suppress_unused_variable_warning(v);
v = hazard(dist, f);
suppress_unused_variable_warning(v);
v = chf(dist, f);
suppress_unused_variable_warning(v);
double d = 1;
v = cdf(dist, d);
suppress_unused_variable_warning(v);
v = cdf(complement(dist, d));
suppress_unused_variable_warning(v);
v = pdf(dist, d);
suppress_unused_variable_warning(v);
v = quantile(dist, d);
suppress_unused_variable_warning(v);
v = quantile(complement(dist, d));
suppress_unused_variable_warning(v);
v = hazard(dist, d);
suppress_unused_variable_warning(v);
v = chf(dist, d);
suppress_unused_variable_warning(v);
#ifndef TEST_MPFR
long double ld = 1;
v = cdf(dist, ld);
suppress_unused_variable_warning(v);
v = cdf(complement(dist, ld));
suppress_unused_variable_warning(v);
v = pdf(dist, ld);
suppress_unused_variable_warning(v);
v = quantile(dist, ld);
suppress_unused_variable_warning(v);
v = quantile(complement(dist, ld));
suppress_unused_variable_warning(v);
v = hazard(dist, ld);
suppress_unused_variable_warning(v);
v = chf(dist, ld);
suppress_unused_variable_warning(v);
#endif
int i = 1;
v = cdf(dist, i);
suppress_unused_variable_warning(v);
v = cdf(complement(dist, i));
suppress_unused_variable_warning(v);
v = pdf(dist, i);
suppress_unused_variable_warning(v);
v = quantile(dist, i);
suppress_unused_variable_warning(v);
v = quantile(complement(dist, i));
suppress_unused_variable_warning(v);
v = hazard(dist, i);
suppress_unused_variable_warning(v);
v = chf(dist, i);
suppress_unused_variable_warning(v);
unsigned long li = 1;
v = cdf(dist, li);
suppress_unused_variable_warning(v);
v = cdf(complement(dist, li));
suppress_unused_variable_warning(v);
v = pdf(dist, li);
suppress_unused_variable_warning(v);
v = quantile(dist, li);
suppress_unused_variable_warning(v);
v = quantile(complement(dist, li));
suppress_unused_variable_warning(v);
v = hazard(dist, li);
suppress_unused_variable_warning(v);
v = chf(dist, li);
suppress_unused_variable_warning(v);
test_extra_members(dist);
}
template <class D>
@@ -207,11 +259,13 @@ struct DistributionConcept
value_type r1 = d.alpha();
value_type r2 = d.beta();
r1 = boost::math::beta_distribution<R, P>::find_alpha(r1, r2);
suppress_unused_variable_warning(r1);
r1 = boost::math::beta_distribution<R, P>::find_beta(r1, r2);
suppress_unused_variable_warning(r1);
r1 = boost::math::beta_distribution<R, P>::find_alpha(r1, r2, r1);
suppress_unused_variable_warning(r1);
r1 = boost::math::beta_distribution<R, P>::find_beta(r1, r2, r1);
(void)r1; // warning suppression
(void)r2; // warning suppression
suppress_unused_variable_warning(r1);
}
template <class R, class P>
static void test_extra_members(const boost::math::binomial_distribution<R, P>& d)
@@ -226,14 +280,14 @@ struct DistributionConcept
r = Distribution::find_upper_bound_on_p(r, r, r, Distribution::jeffreys_prior_interval);
r = Distribution::find_minimum_number_of_trials(r, r, r);
r = Distribution::find_maximum_number_of_trials(r, r, r);
(void)r; // warning suppression
suppress_unused_variable_warning(r);
}
template <class R, class P>
static void test_extra_members(const boost::math::cauchy_distribution<R, P>& d)
{
value_type r = d.location();
r = d.scale();
(void)r; // warning suppression
suppress_unused_variable_warning(r);
}
template <class R, class P>
static void test_extra_members(const boost::math::chi_squared_distribution<R, P>& d)
@@ -241,48 +295,48 @@ struct DistributionConcept
value_type r = d.degrees_of_freedom();
r = Distribution::find_degrees_of_freedom(r, r, r, r);
r = Distribution::find_degrees_of_freedom(r, r, r, r, r);
(void)r; // warning suppression
suppress_unused_variable_warning(r);
}
template <class R, class P>
static void test_extra_members(const boost::math::exponential_distribution<R, P>& d)
{
value_type r = d.lambda();
(void)r; // warning suppression
suppress_unused_variable_warning(r);
}
template <class R, class P>
static void test_extra_members(const boost::math::extreme_value_distribution<R, P>& d)
{
value_type r = d.scale();
r = d.location();
(void)r; // warning suppression
suppress_unused_variable_warning(r);
}
template <class R, class P>
static void test_extra_members(const boost::math::fisher_f_distribution<R, P>& d)
{
value_type r = d.degrees_of_freedom1();
r = d.degrees_of_freedom2();
(void)r; // warning suppression
suppress_unused_variable_warning(r);
}
template <class R, class P>
static void test_extra_members(const boost::math::gamma_distribution<R, P>& d)
{
value_type r = d.scale();
r = d.shape();
(void)r; // warning suppression
suppress_unused_variable_warning(r);
}
template <class R, class P>
static void test_extra_members(const boost::math::inverse_chi_squared_distribution<R, P>& d)
{
value_type r = d.scale();
r = d.degrees_of_freedom();
(void)r; // warning suppression
suppress_unused_variable_warning(r);
}
template <class R, class P>
static void test_extra_members(const boost::math::inverse_gamma_distribution<R, P>& d)
{
value_type r = d.scale();
r = d.shape();
(void)r; // warning suppression
suppress_unused_variable_warning(r);
}
template <class R, class P>
static void test_extra_members(const boost::math::hypergeometric_distribution<R, P>& d)
@@ -290,28 +344,28 @@ struct DistributionConcept
unsigned u = d.defective();
u = d.sample_count();
u = d.total();
(void)u; // warning suppression
suppress_unused_variable_warning(u);
}
template <class R, class P>
static void test_extra_members(const boost::math::laplace_distribution<R, P>& d)
{
value_type r = d.scale();
r = d.location();
(void)r; // warning suppression
suppress_unused_variable_warning(r);
}
template <class R, class P>
static void test_extra_members(const boost::math::logistic_distribution<R, P>& d)
{
value_type r = d.scale();
r = d.location();
(void)r; // warning suppression
suppress_unused_variable_warning(r);
}
template <class R, class P>
static void test_extra_members(const boost::math::lognormal_distribution<R, P>& d)
{
value_type r = d.scale();
r = d.location();
(void)r; // warning suppression
suppress_unused_variable_warning(r);
}
template <class R, class P>
static void test_extra_members(const boost::math::negative_binomial_distribution<R, P>& d)
@@ -322,7 +376,7 @@ struct DistributionConcept
r = Distribution::find_upper_bound_on_p(r, r, r);
r = Distribution::find_minimum_number_of_trials(r, r, r);
r = Distribution::find_maximum_number_of_trials(r, r, r);
(void)r; // warning suppression
suppress_unused_variable_warning(r);
}
template <class R, class P>
static void test_extra_members(const boost::math::non_central_beta_distribution<R, P>& d)
@@ -418,14 +472,17 @@ struct DistributionConcept
(void)r; // warning suppression
}
private:
static Distribution* pd;
static Distribution& get_object()
{
// will never get called:
static char buf[sizeof(Distribution)];
return * reinterpret_cast<Distribution*>(buf);
// In reality this will never get called:
return *pd;
}
}; // struct DistributionConcept
template <class Distribution>
Distribution* DistributionConcept<Distribution>::pd = 0;
} // namespace concepts
} // namespace math
} // namespace boost

View File

@@ -44,17 +44,29 @@ struct RealTypeConcept
r = o / r;
bool b;
b = r == o;
suppress_unused_variable_warning(b);
b = o == r;
suppress_unused_variable_warning(b);
b = r != o;
suppress_unused_variable_warning(b);
b = o != r;
suppress_unused_variable_warning(b);
b = r <= o;
suppress_unused_variable_warning(b);
b = o <= r;
suppress_unused_variable_warning(b);
b = r >= o;
suppress_unused_variable_warning(b);
b = o >= r;
suppress_unused_variable_warning(b);
b = r < o;
suppress_unused_variable_warning(b);
b = o < r;
suppress_unused_variable_warning(b);
b = r > o;
suppress_unused_variable_warning(b);
b = o > r;
suppress_unused_variable_warning(b);
}
void constraints()

View File

@@ -153,7 +153,7 @@ namespace boost
{ // Probability Density/Mass Function.
BOOST_FPU_EXCEPTION_GUARD
// Error check:
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == bernoulli_detail::check_dist_and_k(
"boost::math::pdf(bernoulli_distribution<%1%>, %1%)",
dist.success_fraction(), // 0 to 1
@@ -178,7 +178,7 @@ namespace boost
{ // Cumulative Distribution Function Bernoulli.
RealType p = dist.success_fraction();
// Error check:
RealType result;
RealType result = 0;
if(false == bernoulli_detail::check_dist_and_k(
"boost::math::cdf(bernoulli_distribution<%1%>, %1%)",
p,
@@ -204,7 +204,7 @@ namespace boost
bernoulli_distribution<RealType, Policy> const& dist = c.dist;
RealType p = dist.success_fraction();
// Error checks:
RealType result;
RealType result = 0;
if(false == bernoulli_detail::check_dist_and_k(
"boost::math::cdf(bernoulli_distribution<%1%>, %1%)",
p,
@@ -229,7 +229,7 @@ namespace boost
// Return the number of expected successes k either 0 or 1.
// for a given probability p.
RealType result; // of error checks:
RealType result = 0; // of error checks:
if(false == bernoulli_detail::check_dist_and_prob(
"boost::math::quantile(bernoulli_distribution<%1%>, %1%)",
dist.success_fraction(),
@@ -257,7 +257,7 @@ namespace boost
// Error checks:
RealType q = c.param;
const bernoulli_distribution<RealType, Policy>& dist = c.dist;
RealType result;
RealType result = 0;
if(false == bernoulli_detail::check_dist_and_prob(
"boost::math::quantile(bernoulli_distribution<%1%>, %1%)",
dist.success_fraction(),

View File

@@ -187,7 +187,7 @@ namespace boost
RealType variance) // Expected value of variance.
{
static const char* function = "boost::math::beta_distribution<%1%>::find_alpha";
RealType result; // of error checks.
RealType result = 0; // of error checks.
if(false ==
beta_detail::check_mean(
function, mean, &result, Policy())
@@ -206,7 +206,7 @@ namespace boost
RealType variance) // Expected value of variance.
{
static const char* function = "boost::math::beta_distribution<%1%>::find_beta";
RealType result; // of error checks.
RealType result = 0; // of error checks.
if(false ==
beta_detail::check_mean(
function, mean, &result, Policy())
@@ -229,7 +229,7 @@ namespace boost
RealType probability) // cdf
{
static const char* function = "boost::math::beta_distribution<%1%>::find_alpha";
RealType result; // of error checks.
RealType result = 0; // of error checks.
if(false ==
beta_detail::check_prob(
function, probability, &result, Policy())
@@ -253,7 +253,7 @@ namespace boost
RealType probability) // probability cdf.
{
static const char* function = "boost::math::beta_distribution<%1%>::find_beta";
RealType result; // of error checks.
RealType result = 0; // of error checks.
if(false ==
beta_detail::check_prob(
function, probability, &result, Policy())
@@ -376,7 +376,7 @@ namespace boost
RealType b = dist.beta();
// Argument checks:
RealType result;
RealType result = 0;
if(false == beta_detail::check_dist_and_x(
function,
a, b, x,
@@ -399,7 +399,7 @@ namespace boost
RealType b = dist.beta();
// Argument checks:
RealType result;
RealType result = 0;
if(false == beta_detail::check_dist_and_x(
function,
a, b, x,
@@ -433,7 +433,7 @@ namespace boost
RealType b = dist.beta();
// Argument checks:
RealType result;
RealType result = 0;
if(false == beta_detail::check_dist_and_x(
function,
a, b, x,
@@ -468,7 +468,7 @@ namespace boost
static const char* function = "boost::math::quantile(beta_distribution<%1%> const&, %1%)";
RealType result; // of argument checks:
RealType result = 0; // of argument checks:
RealType a = dist.alpha();
RealType b = dist.beta();
if(false == beta_detail::check_dist_and_prob(
@@ -502,7 +502,7 @@ namespace boost
// Error checks:
RealType q = c.param;
const beta_distribution<RealType, Policy>& dist = c.dist;
RealType result;
RealType result = 0;
RealType a = dist.alpha();
RealType b = dist.beta();
if(false == beta_detail::check_dist_and_prob(

View File

@@ -203,7 +203,7 @@ namespace boost
//
// Error checks:
BOOST_MATH_STD_USING // ADL of std names
RealType result;
RealType result = 0;
RealType trials = dist.trials();
RealType success_fraction = dist.success_fraction();
if(false == binomial_detail::check_dist_and_prob(
@@ -317,7 +317,7 @@ namespace boost
{
static const char* function = "boost::math::binomial_distribution<%1%>::find_lower_bound_on_p";
// Error checks:
RealType result;
RealType result = 0;
if(false == binomial_detail::check_dist_and_k(
function, trials, RealType(0), successes, &result, Policy())
&&
@@ -342,7 +342,7 @@ namespace boost
{
static const char* function = "boost::math::binomial_distribution<%1%>::find_upper_bound_on_p";
// Error checks:
RealType result;
RealType result = 0;
if(false == binomial_detail::check_dist_and_k(
function, trials, RealType(0), successes, &result, Policy())
&&
@@ -369,7 +369,7 @@ namespace boost
{
static const char* function = "boost::math::binomial_distribution<%1%>::find_minimum_number_of_trials";
// Error checks:
RealType result;
RealType result = 0;
if(false == binomial_detail::check_dist_and_k(
function, k, p, k, &result, Policy())
&&
@@ -388,7 +388,7 @@ namespace boost
{
static const char* function = "boost::math::binomial_distribution<%1%>::find_maximum_number_of_trials";
// Error checks:
RealType result;
RealType result = 0;
if(false == binomial_detail::check_dist_and_k(
function, k, p, k, &result, Policy())
&&
@@ -446,7 +446,7 @@ namespace boost
RealType n = dist.trials();
// Error check:
RealType result;
RealType result = 0; // initialization silences some compiler warnings
if(false == binomial_detail::check_dist_and_k(
"boost::math::pdf(binomial_distribution<%1%> const&, %1%)",
n,
@@ -524,7 +524,7 @@ namespace boost
RealType p = dist.success_fraction();
// Error check:
RealType result;
RealType result = 0;
if(false == binomial_detail::check_dist_and_k(
"boost::math::cdf(binomial_distribution<%1%> const&, %1%)",
n,
@@ -598,7 +598,7 @@ namespace boost
RealType p = dist.success_fraction();
// Error checks:
RealType result;
RealType result = 0;
if(false == binomial_detail::check_dist_and_k(
"boost::math::cdf(binomial_distribution<%1%> const&, %1%)",
n,

View File

@@ -56,7 +56,7 @@ RealType cdf_imp(const cauchy_distribution<RealType, Policy>& dist, const RealTy
//
BOOST_MATH_STD_USING // for ADL of std functions
static const char* function = "boost::math::cdf(cauchy<%1%>&, %1%)";
RealType result;
RealType result = 0;
RealType location = dist.location();
RealType scale = dist.scale();
if(false == detail::check_location(function, location, &result, Policy()))
@@ -105,7 +105,7 @@ RealType quantile_imp(
static const char* function = "boost::math::quantile(cauchy<%1%>&, %1%)";
BOOST_MATH_STD_USING // for ADL of std functions
RealType result;
RealType result = 0;
RealType location = dist.location();
RealType scale = dist.scale();
if(false == detail::check_location(function, location, &result, Policy()))
@@ -197,7 +197,7 @@ inline RealType pdf(const cauchy_distribution<RealType, Policy>& dist, const Rea
BOOST_MATH_STD_USING // for ADL of std functions
static const char* function = "boost::math::pdf(cauchy<%1%>&, %1%)";
RealType result;
RealType result = 0;
RealType location = dist.location();
RealType scale = dist.scale();
if(false == detail::check_scale("boost::math::pdf(cauchy<%1%>&, %1%)", scale, &result, Policy()))

View File

@@ -102,7 +102,7 @@ inline RealType pdf(const exponential_distribution<RealType, Policy>& dist, cons
static const char* function = "boost::math::pdf(const exponential_distribution<%1%>&, %1%)";
RealType lambda = dist.lambda();
RealType result;
RealType result = 0;
if(0 == detail::verify_lambda(function, lambda, &result, Policy()))
return result;
if(0 == detail::verify_exp_x(function, x, &result, Policy()))
@@ -118,7 +118,7 @@ inline RealType cdf(const exponential_distribution<RealType, Policy>& dist, cons
static const char* function = "boost::math::cdf(const exponential_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
RealType lambda = dist.lambda();
if(0 == detail::verify_lambda(function, lambda, &result, Policy()))
return result;
@@ -136,7 +136,7 @@ inline RealType quantile(const exponential_distribution<RealType, Policy>& dist,
static const char* function = "boost::math::quantile(const exponential_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
RealType lambda = dist.lambda();
if(0 == detail::verify_lambda(function, lambda, &result, Policy()))
return result;
@@ -159,7 +159,7 @@ inline RealType cdf(const complemented2_type<exponential_distribution<RealType,
static const char* function = "boost::math::cdf(const exponential_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
RealType lambda = c.dist.lambda();
if(0 == detail::verify_lambda(function, lambda, &result, Policy()))
return result;
@@ -177,7 +177,7 @@ inline RealType quantile(const complemented2_type<exponential_distribution<RealT
static const char* function = "boost::math::quantile(const exponential_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
RealType lambda = c.dist.lambda();
if(0 == detail::verify_lambda(function, lambda, &result, Policy()))
return result;
@@ -198,7 +198,7 @@ inline RealType quantile(const complemented2_type<exponential_distribution<RealT
template <class RealType, class Policy>
inline RealType mean(const exponential_distribution<RealType, Policy>& dist)
{
RealType result;
RealType result = 0;
RealType lambda = dist.lambda();
if(0 == detail::verify_lambda("boost::math::mean(const exponential_distribution<%1%>&)", lambda, &result, Policy()))
return result;
@@ -208,7 +208,7 @@ inline RealType mean(const exponential_distribution<RealType, Policy>& dist)
template <class RealType, class Policy>
inline RealType standard_deviation(const exponential_distribution<RealType, Policy>& dist)
{
RealType result;
RealType result = 0;
RealType lambda = dist.lambda();
if(0 == detail::verify_lambda("boost::math::standard_deviation(const exponential_distribution<%1%>&)", lambda, &result, Policy()))
return result;

View File

@@ -94,7 +94,7 @@ inline RealType pdf(const extreme_value_distribution<RealType, Policy>& dist, co
RealType a = dist.location();
RealType b = dist.scale();
RealType result;
RealType result = 0;
if(0 == detail::verify_scale_b("boost::math::pdf(const extreme_value_distribution<%1%>&, %1%)", b, &result, Policy()))
return result;
result = exp((a-x)/b) * exp(-exp((a-x)/b)) / b;
@@ -108,7 +108,7 @@ inline RealType cdf(const extreme_value_distribution<RealType, Policy>& dist, co
RealType a = dist.location();
RealType b = dist.scale();
RealType result;
RealType result = 0;
if(0 == detail::verify_scale_b("boost::math::cdf(const extreme_value_distribution<%1%>&, %1%)", b, &result, Policy()))
return result;
@@ -126,7 +126,7 @@ RealType quantile(const extreme_value_distribution<RealType, Policy>& dist, cons
RealType a = dist.location();
RealType b = dist.scale();
RealType result;
RealType result = 0;
if(0 == detail::verify_scale_b(function, b, &result, Policy()))
return result;
if(0 == detail::check_probability(function, p, &result, Policy()))
@@ -149,7 +149,7 @@ inline RealType cdf(const complemented2_type<extreme_value_distribution<RealType
RealType a = c.dist.location();
RealType b = c.dist.scale();
RealType result;
RealType result = 0;
if(0 == detail::verify_scale_b("boost::math::cdf(const extreme_value_distribution<%1%>&, %1%)", b, &result, Policy()))
return result;
@@ -168,7 +168,7 @@ RealType quantile(const complemented2_type<extreme_value_distribution<RealType,
RealType a = c.dist.location();
RealType b = c.dist.scale();
RealType q = c.param;
RealType result;
RealType result = 0;
if(0 == detail::verify_scale_b(function, b, &result, Policy()))
return result;
if(0 == detail::check_probability(function, q, &result, Policy()))
@@ -189,7 +189,7 @@ inline RealType mean(const extreme_value_distribution<RealType, Policy>& dist)
{
RealType a = dist.location();
RealType b = dist.scale();
RealType result;
RealType result = 0;
if(0 == detail::verify_scale_b("boost::math::mean(const extreme_value_distribution<%1%>&)", b, &result, Policy()))
return result;
return a + constants::euler<RealType>() * b;
@@ -201,7 +201,7 @@ inline RealType standard_deviation(const extreme_value_distribution<RealType, Po
BOOST_MATH_STD_USING // for ADL of std functions.
RealType b = dist.scale();
RealType result;
RealType result = 0;
if(0 == detail::verify_scale_b("boost::math::standard_deviation(const extreme_value_distribution<%1%>&)", b, &result, Policy()))
return result;
return constants::pi<RealType>() * b / sqrt(static_cast<RealType>(6));

View File

@@ -76,7 +76,7 @@ RealType pdf(const fisher_f_distribution<RealType, Policy>& dist, const RealType
RealType df1 = dist.degrees_of_freedom1();
RealType df2 = dist.degrees_of_freedom2();
// Error check:
RealType error_result;
RealType error_result = 0;
static const char* function = "boost::math::pdf(fisher_f_distribution<%1%> const&, %1%)";
if(false == detail::check_df(
function, df1, &error_result, Policy())
@@ -133,7 +133,7 @@ inline RealType cdf(const fisher_f_distribution<RealType, Policy>& dist, const R
RealType df1 = dist.degrees_of_freedom1();
RealType df2 = dist.degrees_of_freedom2();
// Error check:
RealType error_result;
RealType error_result = 0;
if(false == detail::check_df(
function, df1, &error_result, Policy())
&& detail::check_df(
@@ -168,7 +168,7 @@ inline RealType quantile(const fisher_f_distribution<RealType, Policy>& dist, co
RealType df1 = dist.degrees_of_freedom1();
RealType df2 = dist.degrees_of_freedom2();
// Error check:
RealType error_result;
RealType error_result = 0;
if(false == detail::check_df(
function, df1, &error_result, Policy())
&& detail::check_df(
@@ -194,7 +194,7 @@ inline RealType cdf(const complemented2_type<fisher_f_distribution<RealType, Pol
RealType df2 = c.dist.degrees_of_freedom2();
RealType x = c.param;
// Error check:
RealType error_result;
RealType error_result = 0;
if(false == detail::check_df(
function, df1, &error_result, Policy())
&& detail::check_df(
@@ -230,7 +230,7 @@ inline RealType quantile(const complemented2_type<fisher_f_distribution<RealType
RealType df2 = c.dist.degrees_of_freedom2();
RealType p = c.param;
// Error check:
RealType error_result;
RealType error_result = 0;
if(false == detail::check_df(
function, df1, &error_result, Policy())
&& detail::check_df(
@@ -253,7 +253,7 @@ inline RealType mean(const fisher_f_distribution<RealType, Policy>& dist)
RealType df1 = dist.degrees_of_freedom1();
RealType df2 = dist.degrees_of_freedom2();
// Error check:
RealType error_result;
RealType error_result = 0;
if(false == detail::check_df(
function, df1, &error_result, Policy())
&& detail::check_df(
@@ -274,7 +274,7 @@ inline RealType variance(const fisher_f_distribution<RealType, Policy>& dist)
RealType df1 = dist.degrees_of_freedom1();
RealType df2 = dist.degrees_of_freedom2();
// Error check:
RealType error_result;
RealType error_result = 0;
if(false == detail::check_df(
function, df1, &error_result, Policy())
&& detail::check_df(
@@ -295,7 +295,7 @@ inline RealType mode(const fisher_f_distribution<RealType, Policy>& dist)
RealType df1 = dist.degrees_of_freedom1();
RealType df2 = dist.degrees_of_freedom2();
// Error check:
RealType error_result;
RealType error_result = 0;
if(false == detail::check_df(
function, df1, &error_result, Policy())
&& detail::check_df(
@@ -326,7 +326,7 @@ inline RealType skewness(const fisher_f_distribution<RealType, Policy>& dist)
RealType df1 = dist.degrees_of_freedom1();
RealType df2 = dist.degrees_of_freedom2();
// Error check:
RealType error_result;
RealType error_result = 0;
if(false == detail::check_df(
function, df1, &error_result, Policy())
&& detail::check_df(
@@ -357,7 +357,7 @@ inline RealType kurtosis_excess(const fisher_f_distribution<RealType, Policy>& d
RealType df1 = dist.degrees_of_freedom1();
RealType df2 = dist.degrees_of_freedom2();
// Error check:
RealType error_result;
RealType error_result = 0;
if(false == detail::check_df(
function, df1, &error_result, Policy())
&& detail::check_df(

View File

@@ -125,7 +125,7 @@ inline RealType pdf(const gamma_distribution<RealType, Policy>& dist, const Real
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_gamma(function, scale, shape, &result, Policy()))
return result;
if(false == detail::check_gamma_x(function, x, &result, Policy()))
@@ -149,7 +149,7 @@ inline RealType cdf(const gamma_distribution<RealType, Policy>& dist, const Real
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_gamma(function, scale, shape, &result, Policy()))
return result;
if(false == detail::check_gamma_x(function, x, &result, Policy()))
@@ -169,7 +169,7 @@ inline RealType quantile(const gamma_distribution<RealType, Policy>& dist, const
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_gamma(function, scale, shape, &result, Policy()))
return result;
if(false == detail::check_probability(function, p, &result, Policy()))
@@ -193,7 +193,7 @@ inline RealType cdf(const complemented2_type<gamma_distribution<RealType, Policy
RealType shape = c.dist.shape();
RealType scale = c.dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_gamma(function, scale, shape, &result, Policy()))
return result;
if(false == detail::check_gamma_x(function, c.param, &result, Policy()))
@@ -215,7 +215,7 @@ inline RealType quantile(const complemented2_type<gamma_distribution<RealType, P
RealType scale = c.dist.scale();
RealType q = c.param;
RealType result;
RealType result = 0;
if(false == detail::check_gamma(function, scale, shape, &result, Policy()))
return result;
if(false == detail::check_probability(function, q, &result, Policy()))
@@ -239,7 +239,7 @@ inline RealType mean(const gamma_distribution<RealType, Policy>& dist)
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_gamma(function, scale, shape, &result, Policy()))
return result;
@@ -257,7 +257,7 @@ inline RealType variance(const gamma_distribution<RealType, Policy>& dist)
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_gamma(function, scale, shape, &result, Policy()))
return result;
@@ -275,7 +275,7 @@ inline RealType mode(const gamma_distribution<RealType, Policy>& dist)
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_gamma(function, scale, shape, &result, Policy()))
return result;
@@ -304,7 +304,7 @@ inline RealType skewness(const gamma_distribution<RealType, Policy>& dist)
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_gamma(function, scale, shape, &result, Policy()))
return result;
@@ -322,7 +322,7 @@ inline RealType kurtosis_excess(const gamma_distribution<RealType, Policy>& dist
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_gamma(function, scale, shape, &result, Policy()))
return result;

View File

@@ -146,7 +146,7 @@ namespace boost
RealType alpha) // alpha 0.05 equivalent to 95% for one-sided test.
{
static const char* function = "boost::math::geometric<%1%>::find_lower_bound_on_p";
RealType result; // of error checks.
RealType result = 0; // of error checks.
RealType successes = 1;
RealType failures = trials - successes;
if(false == detail::check_probability(function, alpha, &result, Policy())
@@ -171,7 +171,7 @@ namespace boost
RealType alpha) // alpha 0.05 equivalent to 95% for one-sided test.
{
static const char* function = "boost::math::geometric<%1%>::find_upper_bound_on_p";
RealType result; // of error checks.
RealType result = 0; // of error checks.
RealType successes = 1;
RealType failures = trials - successes;
if(false == geometric_detail::check_dist_and_k(
@@ -205,7 +205,7 @@ namespace boost
{
static const char* function = "boost::math::geometric<%1%>::find_minimum_number_of_trials";
// Error checks:
RealType result;
RealType result = 0;
if(false == geometric_detail::check_dist_and_k(
function, p, k, &result, Policy())
&& detail::check_probability(function, alpha, &result, Policy()))
@@ -223,7 +223,7 @@ namespace boost
{
static const char* function = "boost::math::geometric<%1%>::find_maximum_number_of_trials";
// Error checks:
RealType result;
RealType result = 0;
if(false == geometric_detail::check_dist_and_k(
function, p, k, &result, Policy())
&& detail::check_probability(function, alpha, &result, Policy()))
@@ -317,7 +317,7 @@ namespace boost
static const char* function = "boost::math::pdf(const geometric_distribution<%1%>&, %1%)";
RealType p = dist.success_fraction();
RealType result;
RealType result = 0;
if(false == geometric_detail::check_dist_and_k(
function,
p,
@@ -356,7 +356,7 @@ namespace boost
// If necessary, it has already been promoted from an integral type.
RealType p = dist.success_fraction();
// Error check:
RealType result;
RealType result = 0;
if(false == geometric_detail::check_dist_and_k(
function,
p,
@@ -389,7 +389,7 @@ namespace boost
geometric_distribution<RealType, Policy> const& dist = c.dist;
RealType p = dist.success_fraction();
// Error check:
RealType result;
RealType result = 0;
if(false == geometric_detail::check_dist_and_k(
function,
p,
@@ -416,7 +416,7 @@ namespace boost
RealType success_fraction = dist.success_fraction();
// Check dist and x.
RealType result;
RealType result = 0;
if(false == geometric_detail::check_dist_and_prob
(function, success_fraction, x, &result, Policy()))
{
@@ -465,7 +465,7 @@ namespace boost
RealType x = c.param;
const geometric_distribution<RealType, Policy>& dist = c.dist;
RealType success_fraction = dist.success_fraction();
RealType result;
RealType result = 0;
if(false == geometric_detail::check_dist_and_prob(
function,
success_fraction,

View File

@@ -120,7 +120,7 @@ namespace boost { namespace math {
inline RealType pdf(const hypergeometric_distribution<RealType, Policy>& dist, const unsigned& x)
{
static const char* function = "boost::math::pdf(const hypergeometric_distribution<%1%>&, const %1%&)";
RealType result;
RealType result = 0;
if(!dist.check_params(function, &result))
return result;
if(!dist.check_x(x, function, &result))
@@ -148,7 +148,7 @@ namespace boost { namespace math {
inline RealType cdf(const hypergeometric_distribution<RealType, Policy>& dist, const unsigned& x)
{
static const char* function = "boost::math::cdf(const hypergeometric_distribution<%1%>&, const %1%&)";
RealType result;
RealType result = 0;
if(!dist.check_params(function, &result))
return result;
if(!dist.check_x(x, function, &result))
@@ -176,7 +176,7 @@ namespace boost { namespace math {
inline RealType cdf(const complemented2_type<hypergeometric_distribution<RealType, Policy>, unsigned>& c)
{
static const char* function = "boost::math::cdf(const hypergeometric_distribution<%1%>&, const %1%&)";
RealType result;
RealType result = 0;
if(!c.dist.check_params(function, &result))
return result;
if(!c.dist.check_x(c.param, function, &result))
@@ -206,7 +206,7 @@ namespace boost { namespace math {
BOOST_MATH_STD_USING // for ADL of std functions
// Checking function argument
RealType result;
RealType result = 0;
const char* function = "boost::math::quantile(const hypergeometric_distribution<%1%>&, %1%)";
if (false == dist.check_params(function, &result)) return result;
if(false == detail::check_probability(function, p, &result, Policy())) return result;
@@ -220,7 +220,7 @@ namespace boost { namespace math {
BOOST_MATH_STD_USING // for ADL of std functions
// Checking function argument
RealType result;
RealType result = 0;
const char* function = "quantile(const complemented2_type<hypergeometric_distribution<%1%>, %1%>&)";
if (false == c.dist.check_params(function, &result)) return result;
if(false == detail::check_probability(function, c.param, &result, Policy())) return result;

View File

@@ -150,7 +150,7 @@ inline RealType pdf(const inverse_gamma_distribution<RealType, Policy>& dist, co
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_inverse_gamma(function, scale, shape, &result, Policy()))
{ // distribution parameters bad.
return result;
@@ -198,7 +198,7 @@ inline RealType cdf(const inverse_gamma_distribution<RealType, Policy>& dist, co
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_inverse_gamma(function, scale, shape, &result, Policy()))
{ // distribution parameters bad.
return result;
@@ -227,7 +227,7 @@ inline RealType quantile(const inverse_gamma_distribution<RealType, Policy>& dis
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_inverse_gamma(function, scale, shape, &result, Policy()))
return result;
if(false == detail::check_probability(function, p, &result, Policy()))
@@ -253,7 +253,7 @@ inline RealType cdf(const complemented2_type<inverse_gamma_distribution<RealType
RealType shape = c.dist.shape();
RealType scale = c.dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_inverse_gamma(function, scale, shape, &result, Policy()))
return result;
if(false == detail::check_inverse_gamma_x(function, c.param, &result, Policy()))
@@ -275,7 +275,7 @@ inline RealType quantile(const complemented2_type<inverse_gamma_distribution<Rea
RealType scale = c.dist.scale();
RealType q = c.param;
RealType result;
RealType result = 0;
if(false == detail::check_inverse_gamma(function, scale, shape, &result, Policy()))
return result;
if(false == detail::check_probability(function, q, &result, Policy()))
@@ -302,7 +302,7 @@ inline RealType mean(const inverse_gamma_distribution<RealType, Policy>& dist)
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
{
@@ -329,7 +329,7 @@ inline RealType variance(const inverse_gamma_distribution<RealType, Policy>& dis
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
{
return result;
@@ -355,7 +355,7 @@ inline RealType mode(const inverse_gamma_distribution<RealType, Policy>& dist)
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_inverse_gamma(function, scale, shape, &result, Policy()))
{
return result;
@@ -381,7 +381,7 @@ inline RealType skewness(const inverse_gamma_distribution<RealType, Policy>& dis
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
{
@@ -408,7 +408,7 @@ inline RealType kurtosis_excess(const inverse_gamma_distribution<RealType, Polic
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
{
return result;
@@ -431,7 +431,7 @@ inline RealType kurtosis(const inverse_gamma_distribution<RealType, Policy>& dis
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
{

View File

@@ -136,7 +136,7 @@ inline RealType pdf(const inverse_gaussian_distribution<RealType, Policy>& dist,
RealType scale = dist.scale();
RealType mean = dist.mean();
RealType result;
RealType result = 0;
static const char* function = "boost::math::pdf(const inverse_gaussian_distribution<%1%>&, %1%)";
if(false == detail::check_scale(function, scale, &result, Policy()))
{
@@ -170,7 +170,7 @@ inline RealType cdf(const inverse_gaussian_distribution<RealType, Policy>& dist,
RealType scale = dist.scale();
RealType mean = dist.mean();
static const char* function = "boost::math::cdf(const inverse_gaussian_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
{
return result;
@@ -317,7 +317,7 @@ inline RealType quantile(const inverse_gaussian_distribution<RealType, Policy>&
RealType scale = dist.scale();
static const char* function = "boost::math::quantile(const inverse_gaussian_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
return result;
if(false == detail::check_location(function, mean, &result, Policy()))
@@ -375,7 +375,7 @@ inline RealType cdf(const complemented2_type<inverse_gaussian_distribution<RealT
//{ // cdf complement -infinity is unity.
// return 1;
//}
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
return result;
if(false == detail::check_location(function, mean, &result, Policy()))
@@ -407,7 +407,7 @@ inline RealType quantile(const complemented2_type<inverse_gaussian_distribution<
RealType scale = c.dist.scale();
RealType mean = c.dist.mean();
static const char* function = "boost::math::quantile(const complement(inverse_gaussian_distribution<%1%>&), %1%)";
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
return result;
if(false == detail::check_location(function, mean, &result, Policy()))

View File

@@ -97,7 +97,7 @@ inline RealType pdf(const laplace_distribution<RealType, Policy>& dist, const Re
BOOST_MATH_STD_USING // for ADL of std functions
// Checking function argument
RealType result;
RealType result = 0;
const char* function = "boost::math::pdf(const laplace_distribution<%1%>&, %1%))";
if (false == dist.check_parameters(function, &result)) return result;
if (false == detail::check_x(function, x, &result, Policy())) return result;
@@ -126,7 +126,7 @@ inline RealType cdf(const laplace_distribution<RealType, Policy>& dist, const Re
BOOST_MATH_STD_USING // for ADL of std functions
// Checking function argument
RealType result;
RealType result = 0;
const char* function = "boost::math::cdf(const laplace_distribution<%1%>&, %1%)";
if (false == dist.check_parameters(function, &result)) return result;
if (false == detail::check_x(function, x, &result, Policy())) return result;
@@ -157,7 +157,7 @@ inline RealType quantile(const laplace_distribution<RealType, Policy>& dist, con
BOOST_MATH_STD_USING // for ADL of std functions.
// Checking function argument
RealType result;
RealType result = 0;
const char* function = "boost::math::quantile(const laplace_distribution<%1%>&, %1%)";
if (false == dist.check_parameters(function, &result)) return result;
if(false == detail::check_probability(function, p, &result, Policy())) return result;
@@ -199,7 +199,7 @@ inline RealType cdf(const complemented2_type<laplace_distribution<RealType, Poli
RealType x = c.param;
// Checking function argument
RealType result;
RealType result = 0;
const char* function = "boost::math::cdf(const complemented2_type<laplace_distribution<%1%>, %1%>&)";
if(false == detail::check_x(function, x, &result, Policy()))return result;
@@ -233,7 +233,7 @@ inline RealType quantile(const complemented2_type<laplace_distribution<RealType,
RealType q = c.param;
// Checking function argument
RealType result;
RealType result = 0;
const char* function = "quantile(const complemented2_type<laplace_distribution<%1%>, %1%>&)";
if(false == detail::check_probability(function, q, &result, Policy())) return result;

View File

@@ -77,7 +77,7 @@ namespace boost { namespace math {
return 0; // pdf + and - infinity is zero.
}
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, scale , &result, Policy()))
{
return result;
@@ -106,7 +106,7 @@ namespace boost { namespace math {
{
RealType scale = dist.scale();
RealType location = dist.location();
RealType result; // of checks.
RealType result = 0; // of checks.
static const char* function = "boost::math::cdf(const logistic_distribution<%1%>&, %1%)";
if(false == detail::check_scale(function, scale, &result, Policy()))
{
@@ -145,7 +145,7 @@ namespace boost { namespace math {
static const char* function = "boost::math::quantile(const logistic_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
return result;
if(false == detail::check_location(function, location, &result, Policy()))
@@ -186,7 +186,7 @@ namespace boost { namespace math {
if(x < 0) return 1; // cdf complement -infinity is unity.
return 0; // cdf complement +infinity is zero
}
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
return result;
if(false == detail::check_location(function, location, &result, Policy()))
@@ -208,7 +208,7 @@ namespace boost { namespace math {
RealType scale = c.dist.scale();
RealType location = c.dist.location();
static const char* function = "boost::math::quantile(const complement(logistic_distribution<%1%>&), %1%)";
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, scale, &result, Policy()))
return result;
if(false == detail::check_location(function, location, &result, Policy()))

View File

@@ -99,7 +99,7 @@ RealType pdf(const lognormal_distribution<RealType, Policy>& dist, const RealTyp
static const char* function = "boost::math::pdf(const lognormal_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
if(0 == detail::check_scale(function, sigma, &result, Policy()))
return result;
if(0 == detail::check_lognormal_x(function, x, &result, Policy()))
@@ -125,7 +125,7 @@ inline RealType cdf(const lognormal_distribution<RealType, Policy>& dist, const
static const char* function = "boost::math::cdf(const lognormal_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
if(0 == detail::check_lognormal_x(function, x, &result, Policy()))
return result;
@@ -143,7 +143,7 @@ inline RealType quantile(const lognormal_distribution<RealType, Policy>& dist, c
static const char* function = "boost::math::quantile(const lognormal_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
if(0 == detail::check_probability(function, p, &result, Policy()))
return result;
@@ -163,7 +163,7 @@ inline RealType cdf(const complemented2_type<lognormal_distribution<RealType, Po
static const char* function = "boost::math::cdf(const lognormal_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
if(0 == detail::check_lognormal_x(function, c.param, &result, Policy()))
return result;
@@ -181,7 +181,7 @@ inline RealType quantile(const complemented2_type<lognormal_distribution<RealTyp
static const char* function = "boost::math::quantile(const lognormal_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
if(0 == detail::check_probability(function, c.param, &result, Policy()))
return result;
@@ -202,7 +202,7 @@ inline RealType mean(const lognormal_distribution<RealType, Policy>& dist)
RealType mu = dist.location();
RealType sigma = dist.scale();
RealType result;
RealType result = 0;
if(0 == detail::check_scale("boost::math::mean(const lognormal_distribution<%1%>&)", sigma, &result, Policy()))
return result;
@@ -217,7 +217,7 @@ inline RealType variance(const lognormal_distribution<RealType, Policy>& dist)
RealType mu = dist.location();
RealType sigma = dist.scale();
RealType result;
RealType result = 0;
if(0 == detail::check_scale("boost::math::variance(const lognormal_distribution<%1%>&)", sigma, &result, Policy()))
return result;
@@ -232,7 +232,7 @@ inline RealType mode(const lognormal_distribution<RealType, Policy>& dist)
RealType mu = dist.location();
RealType sigma = dist.scale();
RealType result;
RealType result = 0;
if(0 == detail::check_scale("boost::math::mode(const lognormal_distribution<%1%>&)", sigma, &result, Policy()))
return result;
@@ -258,7 +258,7 @@ inline RealType skewness(const lognormal_distribution<RealType, Policy>& dist)
RealType ss = sigma * sigma;
RealType ess = exp(ss);
RealType result;
RealType result = 0;
if(0 == detail::check_scale("boost::math::skewness(const lognormal_distribution<%1%>&)", sigma, &result, Policy()))
return result;
@@ -274,7 +274,7 @@ inline RealType kurtosis(const lognormal_distribution<RealType, Policy>& dist)
RealType sigma = dist.scale();
RealType ss = sigma * sigma;
RealType result;
RealType result = 0;
if(0 == detail::check_scale("boost::math::kurtosis(const lognormal_distribution<%1%>&)", sigma, &result, Policy()))
return result;
@@ -290,7 +290,7 @@ inline RealType kurtosis_excess(const lognormal_distribution<RealType, Policy>&
RealType sigma = dist.scale();
RealType ss = sigma * sigma;
RealType result;
RealType result = 0;
if(0 == detail::check_scale("boost::math::kurtosis_excess(const lognormal_distribution<%1%>&)", sigma, &result, Policy()))
return result;

View File

@@ -165,7 +165,7 @@ namespace boost
RealType alpha) // alpha 0.05 equivalent to 95% for one-sided test.
{
static const char* function = "boost::math::negative_binomial<%1%>::find_lower_bound_on_p";
RealType result; // of error checks.
RealType result = 0; // of error checks.
RealType failures = trials - successes;
if(false == detail::check_probability(function, alpha, &result, Policy())
&& negative_binomial_detail::check_dist_and_k(
@@ -190,7 +190,7 @@ namespace boost
RealType alpha) // alpha 0.05 equivalent to 95% for one-sided test.
{
static const char* function = "boost::math::negative_binomial<%1%>::find_upper_bound_on_p";
RealType result; // of error checks.
RealType result = 0; // of error checks.
RealType failures = trials - successes;
if(false == negative_binomial_detail::check_dist_and_k(
function, successes, RealType(0), failures, &result, Policy())
@@ -222,7 +222,7 @@ namespace boost
{
static const char* function = "boost::math::negative_binomial<%1%>::find_minimum_number_of_trials";
// Error checks:
RealType result;
RealType result = 0;
if(false == negative_binomial_detail::check_dist_and_k(
function, RealType(1), p, k, &result, Policy())
&& detail::check_probability(function, alpha, &result, Policy()))
@@ -239,7 +239,7 @@ namespace boost
{
static const char* function = "boost::math::negative_binomial<%1%>::find_maximum_number_of_trials";
// Error checks:
RealType result;
RealType result = 0;
if(false == negative_binomial_detail::check_dist_and_k(
function, RealType(1), p, k, &result, Policy())
&& detail::check_probability(function, alpha, &result, Policy()))
@@ -343,7 +343,7 @@ namespace boost
RealType r = dist.successes();
RealType p = dist.success_fraction();
RealType result;
RealType result = 0;
if(false == negative_binomial_detail::check_dist_and_k(
function,
r,
@@ -370,7 +370,7 @@ namespace boost
RealType p = dist.success_fraction();
RealType r = dist.successes();
// Error check:
RealType result;
RealType result = 0;
if(false == negative_binomial_detail::check_dist_and_k(
function,
r,
@@ -399,7 +399,7 @@ namespace boost
RealType p = dist.success_fraction();
RealType r = dist.successes();
// Error check:
RealType result;
RealType result = 0;
if(false == negative_binomial_detail::check_dist_and_k(
function,
r,
@@ -435,7 +435,7 @@ namespace boost
RealType p = dist.success_fraction();
RealType r = dist.successes();
// Check dist and P.
RealType result;
RealType result = 0;
if(false == negative_binomial_detail::check_dist_and_prob
(function, r, p, P, &result, Policy()))
{
@@ -509,7 +509,7 @@ namespace boost
const negative_binomial_distribution<RealType, Policy>& dist = c.dist;
RealType p = dist.success_fraction();
RealType r = dist.successes();
RealType result;
RealType result = 0;
if(false == negative_binomial_detail::check_dist_and_prob(
function,
r,

View File

@@ -106,7 +106,7 @@ inline RealType pdf(const normal_distribution<RealType, Policy>& dist, const Rea
// return 0;
//}
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, sd, &result, Policy()))
{
return result;
@@ -138,7 +138,7 @@ inline RealType cdf(const normal_distribution<RealType, Policy>& dist, const Rea
RealType sd = dist.standard_deviation();
RealType mean = dist.mean();
static const char* function = "boost::math::cdf(const normal_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, sd, &result, Policy()))
{
return result;
@@ -179,7 +179,7 @@ inline RealType quantile(const normal_distribution<RealType, Policy>& dist, cons
RealType mean = dist.mean();
static const char* function = "boost::math::quantile(const normal_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, sd, &result, Policy()))
return result;
if(false == detail::check_location(function, mean, &result, Policy()))
@@ -218,7 +218,7 @@ inline RealType cdf(const complemented2_type<normal_distribution<RealType, Polic
//{ // cdf complement -infinity is unity.
// return 1;
//}
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, sd, &result, Policy()))
return result;
if(false == detail::check_location(function, mean, &result, Policy()))
@@ -239,7 +239,7 @@ inline RealType quantile(const complemented2_type<normal_distribution<RealType,
RealType sd = c.dist.standard_deviation();
RealType mean = c.dist.mean();
static const char* function = "boost::math::quantile(const complement(normal_distribution<%1%>&), %1%)";
RealType result;
RealType result = 0;
if(false == detail::check_scale(function, sd, &result, Policy()))
return result;
if(false == detail::check_location(function, mean, &result, Policy()))

View File

@@ -139,7 +139,7 @@ namespace boost
pareto_distribution(RealType scale = 1, RealType shape = 1)
: m_scale(scale), m_shape(shape)
{ // Constructor.
RealType result;
RealType result = 0;
detail::check_pareto("boost::math::pareto_distribution<%1%>::pareto_distribution", scale, shape, &result, Policy());
}
@@ -182,7 +182,7 @@ namespace boost
static const char* function = "boost::math::pdf(const pareto_distribution<%1%>&, %1%)";
RealType scale = dist.scale();
RealType shape = dist.shape();
RealType result;
RealType result = 0;
if(false == (detail::check_pareto_x(function, x, &result, Policy())
&& detail::check_pareto(function, scale, shape, &result, Policy())))
return result;
@@ -201,7 +201,7 @@ namespace boost
static const char* function = "boost::math::cdf(const pareto_distribution<%1%>&, %1%)";
RealType scale = dist.scale();
RealType shape = dist.shape();
RealType result;
RealType result = 0;
if(false == (detail::check_pareto_x(function, x, &result, Policy())
&& detail::check_pareto(function, scale, shape, &result, Policy())))
@@ -222,7 +222,7 @@ namespace boost
{
BOOST_MATH_STD_USING // for ADL of std function pow.
static const char* function = "boost::math::quantile(const pareto_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
RealType scale = dist.scale();
RealType shape = dist.shape();
if(false == (detail::check_probability(function, p, &result, Policy())
@@ -249,7 +249,7 @@ namespace boost
{
BOOST_MATH_STD_USING // for ADL of std function pow.
static const char* function = "boost::math::cdf(const pareto_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
RealType x = c.param;
RealType scale = c.dist.scale();
RealType shape = c.dist.shape();
@@ -271,7 +271,7 @@ namespace boost
{
BOOST_MATH_STD_USING // for ADL of std function pow.
static const char* function = "boost::math::quantile(const pareto_distribution<%1%>&, %1%)";
RealType result;
RealType result = 0;
RealType q = c.param;
RealType scale = c.dist.scale();
RealType shape = c.dist.shape();
@@ -296,7 +296,7 @@ namespace boost
template <class RealType, class Policy>
inline RealType mean(const pareto_distribution<RealType, Policy>& dist)
{
RealType result;
RealType result = 0;
static const char* function = "boost::math::mean(const pareto_distribution<%1%>&, %1%)";
if(false == detail::check_pareto(function, dist.scale(), dist.shape(), &result, Policy()))
{
@@ -322,7 +322,7 @@ namespace boost
template <class RealType, class Policy>
inline RealType median(const pareto_distribution<RealType, Policy>& dist)
{
RealType result;
RealType result = 0;
static const char* function = "boost::math::median(const pareto_distribution<%1%>&, %1%)";
if(false == detail::check_pareto(function, dist.scale(), dist.shape(), &result, Policy()))
{
@@ -335,7 +335,7 @@ namespace boost
template <class RealType, class Policy>
inline RealType variance(const pareto_distribution<RealType, Policy>& dist)
{
RealType result;
RealType result = 0;
RealType scale = dist.scale();
RealType shape = dist.shape();
static const char* function = "boost::math::variance(const pareto_distribution<%1%>&, %1%)";
@@ -361,7 +361,7 @@ namespace boost
inline RealType skewness(const pareto_distribution<RealType, Policy>& dist)
{
BOOST_MATH_STD_USING
RealType result;
RealType result = 0;
RealType shape = dist.shape();
static const char* function = "boost::math::pdf(const pareto_distribution<%1%>&, %1%)";
if(false == detail::check_pareto(function, dist.scale(), shape, &result, Policy()))
@@ -386,7 +386,7 @@ namespace boost
template <class RealType, class Policy>
inline RealType kurtosis(const pareto_distribution<RealType, Policy>& dist)
{
RealType result;
RealType result = 0;
RealType shape = dist.shape();
static const char* function = "boost::math::pdf(const pareto_distribution<%1%>&, %1%)";
if(false == detail::check_pareto(function, dist.scale(), shape, &result, Policy()))
@@ -410,7 +410,7 @@ namespace boost
template <class RealType, class Policy>
inline RealType kurtosis_excess(const pareto_distribution<RealType, Policy>& dist)
{
RealType result;
RealType result = 0;
RealType shape = dist.shape();
static const char* function = "boost::math::pdf(const pareto_distribution<%1%>&, %1%)";
if(false == detail::check_pareto(function, dist.scale(), shape, &result, Policy()))

View File

@@ -316,7 +316,7 @@ namespace boost
RealType mean = dist.mean();
// Error check:
RealType result;
RealType result = 0;
if(false == poisson_detail::check_dist_and_k(
"boost::math::pdf(const poisson_distribution<%1%>&, %1%)",
mean,
@@ -362,7 +362,7 @@ namespace boost
RealType mean = dist.mean();
// Error checks:
RealType result;
RealType result = 0;
if(false == poisson_detail::check_dist_and_k(
"boost::math::cdf(const poisson_distribution<%1%>&, %1%)",
mean,
@@ -414,7 +414,7 @@ namespace boost
RealType mean = dist.mean();
// Error checks:
RealType result;
RealType result = 0;
if(false == poisson_detail::check_dist_and_k(
"boost::math::cdf(const poisson_distribution<%1%>&, %1%)",
mean,
@@ -443,7 +443,7 @@ namespace boost
inline RealType quantile(const poisson_distribution<RealType, Policy>& dist, const RealType& p)
{ // Quantile (or Percent Point) Poisson function.
// Return the number of expected events k for a given probability p.
RealType result; // of Argument checks:
RealType result = 0; // of Argument checks:
if(false == poisson_detail::check_prob(
"boost::math::quantile(const poisson_distribution<%1%>&, %1%)",
p,
@@ -514,7 +514,7 @@ namespace boost
// Error checks:
RealType q = c.param;
const poisson_distribution<RealType, Policy>& dist = c.dist;
RealType result; // of argument checks.
RealType result = 0; // of argument checks.
if(false == poisson_detail::check_prob(
"boost::math::quantile(const poisson_distribution<%1%>&, %1%)",
q,

View File

@@ -98,7 +98,7 @@ inline RealType pdf(const rayleigh_distribution<RealType, Policy>& dist, const R
BOOST_MATH_STD_USING // for ADL of std function exp.
RealType sigma = dist.sigma();
RealType result;
RealType result = 0;
static const char* function = "boost::math::pdf(const rayleigh_distribution<%1%>&, %1%)";
if(false == detail::verify_sigma(function, sigma, &result, Policy()))
{
@@ -118,7 +118,7 @@ inline RealType cdf(const rayleigh_distribution<RealType, Policy>& dist, const R
{
BOOST_MATH_STD_USING // for ADL of std functions
RealType result;
RealType result = 0;
RealType sigma = dist.sigma();
static const char* function = "boost::math::cdf(const rayleigh_distribution<%1%>&, %1%)";
if(false == detail::verify_sigma(function, sigma, &result, Policy()))
@@ -138,7 +138,7 @@ inline RealType quantile(const rayleigh_distribution<RealType, Policy>& dist, co
{
BOOST_MATH_STD_USING // for ADL of std functions
RealType result;
RealType result = 0;
RealType sigma = dist.sigma();
static const char* function = "boost::math::quantile(const rayleigh_distribution<%1%>&, %1%)";
if(false == detail::verify_sigma(function, sigma, &result, Policy()))
@@ -163,7 +163,7 @@ inline RealType cdf(const complemented2_type<rayleigh_distribution<RealType, Pol
{
BOOST_MATH_STD_USING // for ADL of std functions
RealType result;
RealType result = 0;
RealType sigma = c.dist.sigma();
static const char* function = "boost::math::cdf(const rayleigh_distribution<%1%>&, %1%)";
if(false == detail::verify_sigma(function, sigma, &result, Policy()))
@@ -184,7 +184,7 @@ inline RealType quantile(const complemented2_type<rayleigh_distribution<RealType
{
BOOST_MATH_STD_USING // for ADL of std functions, log & sqrt.
RealType result;
RealType result = 0;
RealType sigma = c.dist.sigma();
static const char* function = "boost::math::quantile(const rayleigh_distribution<%1%>&, %1%)";
if(false == detail::verify_sigma(function, sigma, &result, Policy()))
@@ -211,7 +211,7 @@ inline RealType quantile(const complemented2_type<rayleigh_distribution<RealType
template <class RealType, class Policy>
inline RealType mean(const rayleigh_distribution<RealType, Policy>& dist)
{
RealType result;
RealType result = 0;
RealType sigma = dist.sigma();
static const char* function = "boost::math::mean(const rayleigh_distribution<%1%>&, %1%)";
if(false == detail::verify_sigma(function, sigma, &result, Policy()))
@@ -225,7 +225,7 @@ inline RealType mean(const rayleigh_distribution<RealType, Policy>& dist)
template <class RealType, class Policy>
inline RealType variance(const rayleigh_distribution<RealType, Policy>& dist)
{
RealType result;
RealType result = 0;
RealType sigma = dist.sigma();
static const char* function = "boost::math::variance(const rayleigh_distribution<%1%>&, %1%)";
if(false == detail::verify_sigma(function, sigma, &result, Policy()))

View File

@@ -199,7 +199,7 @@ namespace boost{ namespace math
RealType lower = dist.lower();
RealType mode = dist.mode();
RealType upper = dist.upper();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_triangular(function, lower, mode, upper, &result, Policy()))
{
return result;
@@ -237,7 +237,7 @@ namespace boost{ namespace math
RealType lower = dist.lower();
RealType mode = dist.mode();
RealType upper = dist.upper();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_triangular(function, lower, mode, upper, &result, Policy()))
{
return result;
@@ -273,7 +273,7 @@ namespace boost{ namespace math
RealType lower = dist.lower();
RealType mode = dist.mode();
RealType upper = dist.upper();
RealType result; // of checks
RealType result = 0; // of checks
if(false == detail::check_triangular(function,lower, mode, upper, &result, Policy()))
{
return result;
@@ -316,7 +316,7 @@ namespace boost{ namespace math
RealType mode = c.dist.mode();
RealType upper = c.dist.upper();
RealType x = c.param;
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_triangular(function, lower, mode, upper, &result, Policy()))
{
return result;
@@ -352,7 +352,7 @@ namespace boost{ namespace math
RealType m = c.dist.mode();
RealType u = c.dist.upper();
RealType q = c.param; // probability 0 to 1.
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_triangular(function, l, m, u, &result, Policy()))
{
return result;
@@ -399,7 +399,7 @@ namespace boost{ namespace math
RealType lower = dist.lower();
RealType mode = dist.mode();
RealType upper = dist.upper();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_triangular(function, lower, mode, upper, &result, Policy()))
{
return result;
@@ -415,7 +415,7 @@ namespace boost{ namespace math
RealType lower = dist.lower();
RealType mode = dist.mode();
RealType upper = dist.upper();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_triangular(function, lower, mode, upper, &result, Policy()))
{
return result;
@@ -428,7 +428,7 @@ namespace boost{ namespace math
{
static const char* function = "boost::math::mode(const triangular_distribution<%1%>&)";
RealType mode = dist.mode();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_triangular_mode(function, mode, &result, Policy()))
{ // This should never happen!
return result;
@@ -442,7 +442,7 @@ namespace boost{ namespace math
BOOST_MATH_STD_USING // ADL of std functions.
static const char* function = "boost::math::median(const triangular_distribution<%1%>&)";
RealType mode = dist.mode();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_triangular_mode(function, mode, &result, Policy()))
{ // This should never happen!
return result;
@@ -469,7 +469,7 @@ namespace boost{ namespace math
RealType lower = dist.lower();
RealType mode = dist.mode();
RealType upper = dist.upper();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_triangular(function,lower, mode, upper, &result, Policy()))
{
return result;
@@ -485,7 +485,7 @@ namespace boost{ namespace math
RealType lower = dist.lower();
RealType upper = dist.upper();
RealType mode = dist.mode();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_triangular(function,lower, mode, upper, &result, Policy()))
{
return result;
@@ -500,7 +500,7 @@ namespace boost{ namespace math
RealType lower = dist.lower();
RealType upper = dist.upper();
RealType mode = dist.mode();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_triangular(function,lower, mode, upper, &result, Policy()))
{
return result;

View File

@@ -161,7 +161,7 @@ namespace boost{ namespace math
{
RealType lower = dist.lower();
RealType upper = dist.upper();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_uniform("boost::math::pdf(const uniform_distribution<%1%>&, %1%)", lower, upper, &result, Policy()))
{
return result;
@@ -186,7 +186,7 @@ namespace boost{ namespace math
{
RealType lower = dist.lower();
RealType upper = dist.upper();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_uniform("boost::math::cdf(const uniform_distribution<%1%>&, %1%)",lower, upper, &result, Policy()))
{
return result;
@@ -211,7 +211,7 @@ namespace boost{ namespace math
{
RealType lower = dist.lower();
RealType upper = dist.upper();
RealType result; // of checks
RealType result = 0; // of checks
if(false == detail::check_uniform("boost::math::quantile(const uniform_distribution<%1%>&, %1%)",lower, upper, &result, Policy()))
{
return result;
@@ -237,7 +237,7 @@ namespace boost{ namespace math
RealType lower = c.dist.lower();
RealType upper = c.dist.upper();
RealType x = c.param;
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_uniform("boost::math::cdf(const uniform_distribution<%1%>&, %1%)", lower, upper, &result, Policy()))
{
return result;
@@ -263,7 +263,7 @@ namespace boost{ namespace math
RealType lower = c.dist.lower();
RealType upper = c.dist.upper();
RealType q = c.param;
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_uniform("boost::math::quantile(const uniform_distribution<%1%>&, %1%)", lower, upper, &result, Policy()))
{
return result;
@@ -285,7 +285,7 @@ namespace boost{ namespace math
{
RealType lower = dist.lower();
RealType upper = dist.upper();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_uniform("boost::math::mean(const uniform_distribution<%1%>&)", lower, upper, &result, Policy()))
{
return result;
@@ -298,7 +298,7 @@ namespace boost{ namespace math
{
RealType lower = dist.lower();
RealType upper = dist.upper();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_uniform("boost::math::variance(const uniform_distribution<%1%>&)", lower, upper, &result, Policy()))
{
return result;
@@ -312,7 +312,7 @@ namespace boost{ namespace math
{
RealType lower = dist.lower();
RealType upper = dist.upper();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_uniform("boost::math::mode(const uniform_distribution<%1%>&)", lower, upper, &result, Policy()))
{
return result;
@@ -326,7 +326,7 @@ namespace boost{ namespace math
{
RealType lower = dist.lower();
RealType upper = dist.upper();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_uniform("boost::math::median(const uniform_distribution<%1%>&)", lower, upper, &result, Policy()))
{
return result;
@@ -338,7 +338,7 @@ namespace boost{ namespace math
{
RealType lower = dist.lower();
RealType upper = dist.upper();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_uniform("boost::math::skewness(const uniform_distribution<%1%>&)",lower, upper, &result, Policy()))
{
return result;
@@ -351,7 +351,7 @@ namespace boost{ namespace math
{
RealType lower = dist.lower();
RealType upper = dist.upper();
RealType result; // of checks.
RealType result = 0; // of checks.
if(false == detail::check_uniform("boost::math::kurtosis_execess(const uniform_distribution<%1%>&)", lower, upper, &result, Policy()))
{
return result;

View File

@@ -126,7 +126,7 @@ inline RealType pdf(const weibull_distribution<RealType, Policy>& dist, const Re
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_weibull(function, scale, shape, &result, Policy()))
return result;
if(false == detail::check_weibull_x(function, x, &result, Policy()))
@@ -152,7 +152,7 @@ inline RealType cdf(const weibull_distribution<RealType, Policy>& dist, const Re
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_weibull(function, scale, shape, &result, Policy()))
return result;
if(false == detail::check_weibull_x(function, x, &result, Policy()))
@@ -173,7 +173,7 @@ inline RealType quantile(const weibull_distribution<RealType, Policy>& dist, con
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_weibull(function, scale, shape, &result, Policy()))
return result;
if(false == detail::check_probability(function, p, &result, Policy()))
@@ -197,7 +197,7 @@ inline RealType cdf(const complemented2_type<weibull_distribution<RealType, Poli
RealType shape = c.dist.shape();
RealType scale = c.dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_weibull(function, scale, shape, &result, Policy()))
return result;
if(false == detail::check_weibull_x(function, c.param, &result, Policy()))
@@ -219,7 +219,7 @@ inline RealType quantile(const complemented2_type<weibull_distribution<RealType,
RealType scale = c.dist.scale();
RealType q = c.param;
RealType result;
RealType result = 0;
if(false == detail::check_weibull(function, scale, shape, &result, Policy()))
return result;
if(false == detail::check_probability(function, q, &result, Policy()))
@@ -243,7 +243,7 @@ inline RealType mean(const weibull_distribution<RealType, Policy>& dist)
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_weibull(function, scale, shape, &result, Policy()))
return result;
@@ -259,7 +259,7 @@ inline RealType variance(const weibull_distribution<RealType, Policy>& dist)
static const char* function = "boost::math::variance(const weibull_distribution<%1%>)";
RealType result;
RealType result = 0;
if(false == detail::check_weibull(function, scale, shape, &result, Policy()))
{
return result;
@@ -281,7 +281,7 @@ inline RealType mode(const weibull_distribution<RealType, Policy>& dist)
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_weibull(function, scale, shape, &result, Policy()))
{
return result;
@@ -302,7 +302,7 @@ inline RealType median(const weibull_distribution<RealType, Policy>& dist)
RealType shape = dist.shape(); // Wikipedia k
RealType scale = dist.scale(); // Wikipedia lambda
RealType result;
RealType result = 0;
if(false == detail::check_weibull(function, scale, shape, &result, Policy()))
{
return result;
@@ -322,7 +322,7 @@ inline RealType skewness(const weibull_distribution<RealType, Policy>& dist)
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_weibull(function, scale, shape, &result, Policy()))
{
return result;
@@ -348,7 +348,7 @@ inline RealType kurtosis_excess(const weibull_distribution<RealType, Policy>& di
RealType shape = dist.shape();
RealType scale = dist.scale();
RealType result;
RealType result = 0;
if(false == detail::check_weibull(function, scale, shape, &result, Policy()))
return result;

View File

@@ -616,7 +616,7 @@ inline R checked_narrowing_cast(T val, const char* function)
//
// Most of what follows will evaluate to a no-op:
//
R result;
R result = 0;
if(detail::check_overflow<R>(val, &result, function, overflow_type()))
return result;
if(detail::check_underflow<R>(val, &result, function, underflow_type()))

View File

@@ -738,6 +738,7 @@ struct basic_digits<long double> : public mpl::int_<LDBL_MANT_DIG>{ };
template <class Real, class Policy>
struct precision
{
BOOST_STATIC_ASSERT( ::std::numeric_limits<Real>::radix == 2);
typedef typename Policy::precision_type precision_type;
typedef basic_digits<Real> digits_t;
typedef typename mpl::if_<
@@ -775,6 +776,7 @@ struct precision<long double, Policy>
template <class Real, class Policy>
struct precision
{
BOOST_STATIC_ASSERT((::std::numeric_limits<Real>::radix == 2) || ((::std::numeric_limits<Real>::is_specialized == 0) || (::std::numeric_limits<Real>::digits == 0)));
#ifndef __BORLANDC__
typedef typename Policy::precision_type precision_type;
typedef typename mpl::if_c<
@@ -896,8 +898,10 @@ inline T get_epsilon_imp(mpl::true_ const&)
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::radix == 2);
#else
BOOST_ASSERT(::std::numeric_limits<T>::is_specialized);
BOOST_ASSERT(::std::numeric_limits<T>::radix == 2);
#endif
typedef typename boost::math::policies::precision<T, Policy>::type p_t;
typedef mpl::bool_<p_t::value <= std::numeric_limits<boost::uintmax_t>::digits> is_small_int;
@@ -916,7 +920,7 @@ inline T get_epsilon_imp(mpl::false_ const&)
template <class T, class Policy>
inline T get_epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T))
{
typedef mpl::bool_< std::numeric_limits<T>::is_specialized > tag_type;
typedef mpl::bool_< (std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::radix == 2)) > tag_type;
return detail::get_epsilon_imp<T, Policy>(tag_type());
}

View File

@@ -326,6 +326,10 @@ T ibeta_power_terms(T a,
T b2 = (y * cgh) / bgh;
l1 = a * log(b1);
l2 = b * log(b2);
BOOST_MATH_INSTRUMENT_VARIABLE(b1);
BOOST_MATH_INSTRUMENT_VARIABLE(b2);
BOOST_MATH_INSTRUMENT_VARIABLE(l1);
BOOST_MATH_INSTRUMENT_VARIABLE(l2);
if((l1 >= tools::log_max_value<T>())
|| (l1 <= tools::log_min_value<T>())
|| (l2 >= tools::log_max_value<T>())
@@ -384,9 +388,8 @@ T ibeta_power_terms(T a,
return pow(x, a) * pow(y, b);
}
T result;
T result= 0; // assignment here silences warnings later
T prefix = 1;
T c = a + b;
// integration limits for the gamma functions:
@@ -519,7 +522,6 @@ T ibeta_series(T a, T b, T x, T s0, const boost::math::lanczos::undefined_lanczo
if(normalised)
{
T prefix = 1;
T c = a + b;
// figure out integration limits for the gamma function:

View File

@@ -90,6 +90,8 @@ T cbrt_imp(T z, const Policy& pol)
typedef typename largest_cbrt_int_type<T>::type shift_type;
BOOST_STATIC_ASSERT( ::std::numeric_limits<shift_type>::radix == 2);
if(abs(i_exp3) < std::numeric_limits<shift_type>::digits)
{
if(i_exp3 > 0)

View File

@@ -529,7 +529,10 @@ inline T fast_students_t_quantile(T df, T p, const Policy& pol)
typedef mpl::bool_<
(std::numeric_limits<T>::digits <= 53)
&&
(std::numeric_limits<T>::is_specialized)> tag_type;
(std::numeric_limits<T>::is_specialized)
&&
(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%)");
}

View File

@@ -1,3 +1,4 @@
// Copyright John Maddock 2006-7.
// Copyright Paul A. Bristow 2007.
@@ -150,6 +151,7 @@ T gamma_imp(T z, const Policy& pol, const L& l)
if(z <= -20)
{
result = gamma_imp(T(-z), pol, l) * sinpx(z);
BOOST_MATH_INSTRUMENT_VARIABLE(result);
if((fabs(result) < 1) && (tools::max_value<T>() * fabs(result) < boost::math::constants::pi<T>()))
return policies::raise_overflow_error<T>(function, "Result of tgamma is too large to represent.", pol);
result = -boost::math::constants::pi<T>() / result;
@@ -157,6 +159,7 @@ T gamma_imp(T z, const Policy& pol, const L& l)
return policies::raise_underflow_error<T>(function, "Result of tgamma is too small to represent.", pol);
if((boost::math::fpclassify)(result) == (int)FP_SUBNORMAL)
return policies::raise_denorm_error<T>(function, "Result of tgamma is denormalized.", result, pol);
BOOST_MATH_INSTRUMENT_VARIABLE(result);
return result;
}
@@ -167,29 +170,41 @@ T gamma_imp(T z, const Policy& pol, const L& l)
z += 1;
}
}
BOOST_MATH_INSTRUMENT_VARIABLE(result);
if((floor(z) == z) && (z < max_factorial<T>::value))
{
result *= unchecked_factorial<T>(itrunc(z, pol) - 1);
BOOST_MATH_INSTRUMENT_VARIABLE(result);
}
else
{
result *= L::lanczos_sum(z);
BOOST_MATH_INSTRUMENT_VARIABLE(result);
BOOST_MATH_INSTRUMENT_VARIABLE(tools::log_max_value<T>());
if(z * log(z) > tools::log_max_value<T>())
{
// we're going to overflow unless this is done with care:
T zgh = (z + static_cast<T>(L::g()) - boost::math::constants::half<T>());
BOOST_MATH_INSTRUMENT_VARIABLE(zgh);
if(log(zgh) * z / 2 > tools::log_max_value<T>())
return policies::raise_overflow_error<T>(function, "Result of tgamma is too large to represent.", pol);
T hp = pow(zgh, (z / 2) - T(0.25));
BOOST_MATH_INSTRUMENT_VARIABLE(hp);
result *= hp / exp(zgh);
BOOST_MATH_INSTRUMENT_VARIABLE(result);
if(tools::max_value<T>() / hp < result)
return policies::raise_overflow_error<T>(function, "Result of tgamma is too large to represent.", pol);
result *= hp;
BOOST_MATH_INSTRUMENT_VARIABLE(result);
}
else
{
T zgh = (z + static_cast<T>(L::g()) - boost::math::constants::half<T>());
BOOST_MATH_INSTRUMENT_VARIABLE(zgh);
BOOST_MATH_INSTRUMENT_VARIABLE(pow(zgh, z - boost::math::constants::half<T>()));
BOOST_MATH_INSTRUMENT_VARIABLE(exp(zgh));
result *= pow(zgh, z - boost::math::constants::half<T>()) / exp(zgh);
BOOST_MATH_INSTRUMENT_VARIABLE(result);
}
}
return result;

View File

@@ -253,6 +253,12 @@ inline T max BOOST_PREVENT_MACRO_SUBSTITUTION(T a, T b, T c, T d)
return (std::max)((std::max)(a, b), (std::max)(c, d));
}
} // namespace tools
template <class T>
void suppress_unused_variable_warning(const T&)
{
}
}} // namespace boost namespace math
#if ((defined(__linux__) && !defined(__UCLIBC__)) || defined(__QNX__) || defined(__IBMCPP__)) && !defined(BOOST_NO_FENV_H)

View File

@@ -45,8 +45,10 @@ inline int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::radix == 2);
#else
BOOST_ASSERT(::std::numeric_limits<T>::is_specialized);
BOOST_ASSERT(::std::numeric_limits<T>::radix == 2);
#endif
return std::numeric_limits<T>::digits;
}
@@ -303,14 +305,14 @@ inline T forth_root_epsilon_imp(const T*, const Tag&)
template <class T>
inline T root_epsilon()
{
typedef mpl::int_<std::numeric_limits<T>::digits> tag_type;
typedef mpl::int_< (::std::numeric_limits<T>::radix == 2) ? std::numeric_limits<T>::digits : 0> tag_type;
return detail::root_epsilon_imp(static_cast<T const*>(0), tag_type());
}
template <class T>
inline T forth_root_epsilon()
{
typedef mpl::int_<std::numeric_limits<T>::digits> tag_type;
typedef mpl::int_< (::std::numeric_limits<T>::radix == 2) ? std::numeric_limits<T>::digits : 0> tag_type;
return detail::forth_root_epsilon_imp(static_cast<T const*>(0), tag_type());
}