Remove no longer needed special_functions sub-directory.
Also fix lots of inspect-report failures.
@@ -579,4 +579,4 @@ f(x) == (0 compared to uncertainty 7.311312755e-26) is true
|
||||
RUN SUCCESSFUL (total time: 90ms)
|
||||
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -160,7 +160,7 @@ relative_difference = 3.40282347e+038
|
||||
/*`
|
||||
Note that finite values are always infinitely far away from infinities even if those finite values are very large:*/
|
||||
|
||||
a = std::numeric_limits<float>::max();
|
||||
a = (std::numeric_limits<float>::max)();
|
||||
b = std::numeric_limits<float>::infinity();
|
||||
std::cout << "a = " << a << std::endl;
|
||||
std::cout << "b = " << b << std::endl;
|
||||
@@ -377,7 +377,7 @@ A few values near zero are tested with varying tolerance below.
|
||||
c = std::numeric_limits<float>::denorm_min(); // 1.40129846e-045
|
||||
std::cout << "denorm_ min =" << c << ", is_small is " << is_small(c, epsilon) << std::endl; // true
|
||||
|
||||
c = std::numeric_limits<float>::min(); // 1.17549435e-038
|
||||
c = (std::numeric_limits<float>::min)(); // 1.17549435e-038
|
||||
std::cout << "min = " << c << ", is_small is " << is_small(c, epsilon) << std::endl; // true
|
||||
|
||||
c = 1 * epsilon; // 1.19209290e-007
|
||||
|
||||
@@ -16,140 +16,140 @@
|
||||
|
||||
struct ds_info
|
||||
{
|
||||
std::string name;
|
||||
double iat_sample_mean;
|
||||
double iat_sample_sd;
|
||||
boost::math::hyperexponential iat_he;
|
||||
double multi_lt_sample_mean;
|
||||
double multi_lt_sample_sd;
|
||||
boost::math::hyperexponential multi_lt_he;
|
||||
double single_lt_sample_mean;
|
||||
double single_lt_sample_sd;
|
||||
boost::math::hyperexponential single_lt_he;
|
||||
std::string name;
|
||||
double iat_sample_mean;
|
||||
double iat_sample_sd;
|
||||
boost::math::hyperexponential iat_he;
|
||||
double multi_lt_sample_mean;
|
||||
double multi_lt_sample_sd;
|
||||
boost::math::hyperexponential multi_lt_he;
|
||||
double single_lt_sample_mean;
|
||||
double single_lt_sample_sd;
|
||||
boost::math::hyperexponential single_lt_he;
|
||||
};
|
||||
|
||||
// DS1 dataset
|
||||
ds_info make_ds1()
|
||||
{
|
||||
ds_info ds;
|
||||
ds_info ds;
|
||||
|
||||
ds.name = "DS1";
|
||||
ds.name = "DS1";
|
||||
|
||||
// VM interarrival time distribution
|
||||
const double iat_fit_probs[] = {0.34561,0.08648,0.56791};
|
||||
const double iat_fit_rates[] = {0.0008,0.00005,0.02894};
|
||||
ds.iat_sample_mean = 2202.1;
|
||||
ds.iat_sample_sd = 2.2e+4;
|
||||
ds.iat_he = boost::math::hyperexponential(iat_fit_probs, iat_fit_rates);
|
||||
// VM interarrival time distribution
|
||||
const double iat_fit_probs[] = { 0.34561,0.08648,0.56791 };
|
||||
const double iat_fit_rates[] = { 0.0008,0.00005,0.02894 };
|
||||
ds.iat_sample_mean = 2202.1;
|
||||
ds.iat_sample_sd = 2.2e+4;
|
||||
ds.iat_he = boost::math::hyperexponential(iat_fit_probs, iat_fit_rates);
|
||||
|
||||
// Multi-core VM lifetime distribution
|
||||
const double multi_lt_fit_probs[] = {0.24667,0.37948,0.37385};
|
||||
const double multi_lt_fit_rates[] = {0.00004,0.000002,0.00059};
|
||||
ds.multi_lt_sample_mean = 257173;
|
||||
ds.multi_lt_sample_sd = 4.6e+5;
|
||||
ds.multi_lt_he = boost::math::hyperexponential(multi_lt_fit_probs, multi_lt_fit_rates);
|
||||
// Multi-core VM lifetime distribution
|
||||
const double multi_lt_fit_probs[] = { 0.24667,0.37948,0.37385 };
|
||||
const double multi_lt_fit_rates[] = { 0.00004,0.000002,0.00059 };
|
||||
ds.multi_lt_sample_mean = 257173;
|
||||
ds.multi_lt_sample_sd = 4.6e+5;
|
||||
ds.multi_lt_he = boost::math::hyperexponential(multi_lt_fit_probs, multi_lt_fit_rates);
|
||||
|
||||
// Single-core VM lifetime distribution
|
||||
const double single_lt_fit_probs[] = {0.09325,0.22251,0.68424};
|
||||
const double single_lt_fit_rates[] = {0.000003,0.00109,0.00109};
|
||||
ds.single_lt_sample_mean = 28754.4;
|
||||
ds.single_lt_sample_sd = 1.6e+5;
|
||||
ds.single_lt_he = boost::math::hyperexponential(single_lt_fit_probs, single_lt_fit_rates);
|
||||
// Single-core VM lifetime distribution
|
||||
const double single_lt_fit_probs[] = { 0.09325,0.22251,0.68424 };
|
||||
const double single_lt_fit_rates[] = { 0.000003,0.00109,0.00109 };
|
||||
ds.single_lt_sample_mean = 28754.4;
|
||||
ds.single_lt_sample_sd = 1.6e+5;
|
||||
ds.single_lt_he = boost::math::hyperexponential(single_lt_fit_probs, single_lt_fit_rates);
|
||||
|
||||
return ds;
|
||||
return ds;
|
||||
}
|
||||
|
||||
// DS2 dataset
|
||||
ds_info make_ds2()
|
||||
{
|
||||
ds_info ds;
|
||||
ds_info ds;
|
||||
|
||||
ds.name = "DS2";
|
||||
ds.name = "DS2";
|
||||
|
||||
// VM interarrival time distribution
|
||||
const double iat_fit_probs[] = {0.38881,0.18227,0.42892};
|
||||
const double iat_fit_rates[] = {0.000006,0.05228,0.00081};
|
||||
ds.iat_sample_mean = 41285.7;
|
||||
ds.iat_sample_sd = 1.1e+05;
|
||||
ds.iat_he = boost::math::hyperexponential(iat_fit_probs, iat_fit_rates);
|
||||
// VM interarrival time distribution
|
||||
const double iat_fit_probs[] = { 0.38881,0.18227,0.42892 };
|
||||
const double iat_fit_rates[] = { 0.000006,0.05228,0.00081 };
|
||||
ds.iat_sample_mean = 41285.7;
|
||||
ds.iat_sample_sd = 1.1e+05;
|
||||
ds.iat_he = boost::math::hyperexponential(iat_fit_probs, iat_fit_rates);
|
||||
|
||||
// Multi-core VM lifetime distribution
|
||||
const double multi_lt_fit_probs[] = {0.42093,0.43960,0.13947};
|
||||
const double multi_lt_fit_rates[] = {0.00186,0.00008,0.0000008};
|
||||
ds.multi_lt_sample_mean = 144669.0;
|
||||
ds.multi_lt_sample_sd = 7.9e+05;
|
||||
ds.multi_lt_he = boost::math::hyperexponential(multi_lt_fit_probs, multi_lt_fit_rates);
|
||||
// Multi-core VM lifetime distribution
|
||||
const double multi_lt_fit_probs[] = { 0.42093,0.43960,0.13947 };
|
||||
const double multi_lt_fit_rates[] = { 0.00186,0.00008,0.0000008 };
|
||||
ds.multi_lt_sample_mean = 144669.0;
|
||||
ds.multi_lt_sample_sd = 7.9e+05;
|
||||
ds.multi_lt_he = boost::math::hyperexponential(multi_lt_fit_probs, multi_lt_fit_rates);
|
||||
|
||||
// Single-core VM lifetime distribution
|
||||
const double single_lt_fit_probs[] = {0.44885,0.30675,0.2444};
|
||||
const double single_lt_fit_rates[] = {0.00143,0.00005,0.0000004};
|
||||
ds.single_lt_sample_mean = 599815.0;
|
||||
ds.single_lt_sample_sd = 1.7e+06;
|
||||
ds.single_lt_he = boost::math::hyperexponential(single_lt_fit_probs, single_lt_fit_rates);
|
||||
// Single-core VM lifetime distribution
|
||||
const double single_lt_fit_probs[] = { 0.44885,0.30675,0.2444 };
|
||||
const double single_lt_fit_rates[] = { 0.00143,0.00005,0.0000004 };
|
||||
ds.single_lt_sample_mean = 599815.0;
|
||||
ds.single_lt_sample_sd = 1.7e+06;
|
||||
ds.single_lt_he = boost::math::hyperexponential(single_lt_fit_probs, single_lt_fit_rates);
|
||||
|
||||
return ds;
|
||||
return ds;
|
||||
}
|
||||
|
||||
// DS3 dataset
|
||||
ds_info make_ds3()
|
||||
{
|
||||
ds_info ds;
|
||||
ds_info ds;
|
||||
|
||||
ds.name = "DS3";
|
||||
ds.name = "DS3";
|
||||
|
||||
// VM interarrival time distribution
|
||||
const double iat_fit_probs[] = {0.39442,0.24644,0.35914};
|
||||
const double iat_fit_rates[] = {0.00030,0.00003,0.00257};
|
||||
ds.iat_sample_mean = 11238.8;
|
||||
ds.iat_sample_sd = 3.0e+04;
|
||||
ds.iat_he = boost::math::hyperexponential(iat_fit_probs, iat_fit_rates);
|
||||
// VM interarrival time distribution
|
||||
const double iat_fit_probs[] = { 0.39442,0.24644,0.35914 };
|
||||
const double iat_fit_rates[] = { 0.00030,0.00003,0.00257 };
|
||||
ds.iat_sample_mean = 11238.8;
|
||||
ds.iat_sample_sd = 3.0e+04;
|
||||
ds.iat_he = boost::math::hyperexponential(iat_fit_probs, iat_fit_rates);
|
||||
|
||||
// Multi-core VM lifetime distribution
|
||||
const double multi_lt_fit_probs[] = {0.37621,0.14838,0.47541};
|
||||
const double multi_lt_fit_rates[] = {0.00498,0.000005,0.00022};
|
||||
ds.multi_lt_sample_mean = 30739.2;
|
||||
ds.multi_lt_sample_sd = 1.6e+05;
|
||||
ds.multi_lt_he = boost::math::hyperexponential(multi_lt_fit_probs, multi_lt_fit_rates);
|
||||
// Multi-core VM lifetime distribution
|
||||
const double multi_lt_fit_probs[] = { 0.37621,0.14838,0.47541 };
|
||||
const double multi_lt_fit_rates[] = { 0.00498,0.000005,0.00022 };
|
||||
ds.multi_lt_sample_mean = 30739.2;
|
||||
ds.multi_lt_sample_sd = 1.6e+05;
|
||||
ds.multi_lt_he = boost::math::hyperexponential(multi_lt_fit_probs, multi_lt_fit_rates);
|
||||
|
||||
// Single-core VM lifetime distribution
|
||||
const double single_lt_fit_probs[] = {0.34131,0.12544,0.53325};
|
||||
const double single_lt_fit_rates[] = {0.000297,0.000003,0.00410};
|
||||
ds.single_lt_sample_mean = 44447.8;
|
||||
ds.single_lt_sample_sd = 2.2e+05;
|
||||
ds.single_lt_he = boost::math::hyperexponential(single_lt_fit_probs, single_lt_fit_rates);
|
||||
// Single-core VM lifetime distribution
|
||||
const double single_lt_fit_probs[] = { 0.34131,0.12544,0.53325 };
|
||||
const double single_lt_fit_rates[] = { 0.000297,0.000003,0.00410 };
|
||||
ds.single_lt_sample_mean = 44447.8;
|
||||
ds.single_lt_sample_sd = 2.2e+05;
|
||||
ds.single_lt_he = boost::math::hyperexponential(single_lt_fit_probs, single_lt_fit_rates);
|
||||
|
||||
return ds;
|
||||
return ds;
|
||||
}
|
||||
|
||||
void print_fitted(ds_info const& ds)
|
||||
{
|
||||
const double secs_in_a_hour = 3600;
|
||||
const double secs_in_a_month = 30*24*secs_in_a_hour;
|
||||
const double secs_in_a_hour = 3600;
|
||||
const double secs_in_a_month = 30 * 24 * secs_in_a_hour;
|
||||
|
||||
std::cout << "### " << ds.name << std::endl;
|
||||
std::cout << "* Fitted Request Interarrival Time" << std::endl;
|
||||
std::cout << " - Mean (SD): " << boost::math::mean(ds.iat_he) << " (" << boost::math::standard_deviation(ds.iat_he) << ") seconds." << std::endl;
|
||||
std::cout << " - 99th Percentile: " << boost::math::quantile(ds.iat_he, 0.99) << " seconds." << std::endl;
|
||||
std::cout << " - Probability that a VM will arrive within 30 minutes: " << boost::math::cdf(ds.iat_he, secs_in_a_hour/2.0) << std::endl;
|
||||
std::cout << " - Probability that a VM will arrive after 1 hour: " << boost::math::cdf(boost::math::complement(ds.iat_he, secs_in_a_hour)) << std::endl;
|
||||
std::cout << "* Fitted Multi-core VM Lifetime" << std::endl;
|
||||
std::cout << " - Mean (SD): " << boost::math::mean(ds.multi_lt_he) << " (" << boost::math::standard_deviation(ds.multi_lt_he) << ") seconds." << std::endl;
|
||||
std::cout << " - 99th Percentile: " << boost::math::quantile(ds.multi_lt_he, 0.99) << " seconds." << std::endl;
|
||||
std::cout << " - Probability that a VM will last for less than 1 month: " << boost::math::cdf(ds.multi_lt_he, secs_in_a_month) << std::endl;
|
||||
std::cout << " - Probability that a VM will last for more than 3 months: " << boost::math::cdf(boost::math::complement(ds.multi_lt_he, 3.0*secs_in_a_month)) << std::endl;
|
||||
std::cout << "* Fitted Single-core VM Lifetime" << std::endl;
|
||||
std::cout << " - Mean (SD): " << boost::math::mean(ds.single_lt_he) << " (" << boost::math::standard_deviation(ds.single_lt_he) << ") seconds." << std::endl;
|
||||
std::cout << " - 99th Percentile: " << boost::math::quantile(ds.single_lt_he, 0.99) << " seconds." << std::endl;
|
||||
std::cout << " - Probability that a VM will last for less than 1 month: " << boost::math::cdf(ds.single_lt_he, secs_in_a_month) << std::endl;
|
||||
std::cout << " - Probability that a VM will last for more than 3 months: " << boost::math::cdf(boost::math::complement(ds.single_lt_he, 3.0*secs_in_a_month)) << std::endl;
|
||||
std::cout << "### " << ds.name << std::endl;
|
||||
std::cout << "* Fitted Request Interarrival Time" << std::endl;
|
||||
std::cout << " - Mean (SD): " << boost::math::mean(ds.iat_he) << " (" << boost::math::standard_deviation(ds.iat_he) << ") seconds." << std::endl;
|
||||
std::cout << " - 99th Percentile: " << boost::math::quantile(ds.iat_he, 0.99) << " seconds." << std::endl;
|
||||
std::cout << " - Probability that a VM will arrive within 30 minutes: " << boost::math::cdf(ds.iat_he, secs_in_a_hour / 2.0) << std::endl;
|
||||
std::cout << " - Probability that a VM will arrive after 1 hour: " << boost::math::cdf(boost::math::complement(ds.iat_he, secs_in_a_hour)) << std::endl;
|
||||
std::cout << "* Fitted Multi-core VM Lifetime" << std::endl;
|
||||
std::cout << " - Mean (SD): " << boost::math::mean(ds.multi_lt_he) << " (" << boost::math::standard_deviation(ds.multi_lt_he) << ") seconds." << std::endl;
|
||||
std::cout << " - 99th Percentile: " << boost::math::quantile(ds.multi_lt_he, 0.99) << " seconds." << std::endl;
|
||||
std::cout << " - Probability that a VM will last for less than 1 month: " << boost::math::cdf(ds.multi_lt_he, secs_in_a_month) << std::endl;
|
||||
std::cout << " - Probability that a VM will last for more than 3 months: " << boost::math::cdf(boost::math::complement(ds.multi_lt_he, 3.0*secs_in_a_month)) << std::endl;
|
||||
std::cout << "* Fitted Single-core VM Lifetime" << std::endl;
|
||||
std::cout << " - Mean (SD): " << boost::math::mean(ds.single_lt_he) << " (" << boost::math::standard_deviation(ds.single_lt_he) << ") seconds." << std::endl;
|
||||
std::cout << " - 99th Percentile: " << boost::math::quantile(ds.single_lt_he, 0.99) << " seconds." << std::endl;
|
||||
std::cout << " - Probability that a VM will last for less than 1 month: " << boost::math::cdf(ds.single_lt_he, secs_in_a_month) << std::endl;
|
||||
std::cout << " - Probability that a VM will last for more than 3 months: " << boost::math::cdf(boost::math::complement(ds.single_lt_he, 3.0*secs_in_a_month)) << std::endl;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
print_fitted(make_ds1());
|
||||
print_fitted(make_ds1());
|
||||
|
||||
print_fitted(make_ds2());
|
||||
print_fitted(make_ds2());
|
||||
|
||||
print_fitted(make_ds3());
|
||||
print_fitted(make_ds3());
|
||||
}
|
||||
//]
|
||||
|
||||
@@ -44,7 +44,7 @@ at x = 3= 2. In other words,
|
||||
|
||||
The expected result is
|
||||
|
||||
0:74535 59924 99929 89880 . (5)
|
||||
0:74535 59924 99929 89880 . (5)
|
||||
The program below uses the derivative template in order to perform
|
||||
the numerical calculation of this derivative. The program also compares the
|
||||
numerically-obtained result with the expected result and reports the absolute
|
||||
|
||||
@@ -140,7 +140,7 @@ struct root_info
|
||||
std::vector<int> times; // arbirary units (ticks).
|
||||
//boost::int_least64_t min_time = std::numeric_limits<boost::int_least64_t>::max(); // Used to normalize times (as int).
|
||||
std::vector<double> normed_times;
|
||||
int min_time = std::numeric_limits<int>::max(); // Used to normalize times.
|
||||
int min_time = (std::numeric_limits<int>::max)(); // Used to normalize times.
|
||||
std::vector<uintmax_t> iterations;
|
||||
std::vector<long int> distances;
|
||||
std::vector<cpp_bin_float_100> full_results;
|
||||
|
||||
@@ -148,7 +148,7 @@ struct root_info
|
||||
std::vector<int> times;
|
||||
//boost::int_least64_t min_time = std::numeric_limits<boost::int_least64_t>::max(); // Used to normalize times (as int).
|
||||
std::vector<double> normed_times;
|
||||
boost::int_least64_t min_time = std::numeric_limits<boost::int_least64_t>::max(); // Used to normalize times.
|
||||
boost::int_least64_t min_time = (std::numeric_limits<boost::int_least64_t>::max)(); // Used to normalize times.
|
||||
std::vector<uintmax_t> iterations;
|
||||
std::vector<long int> distances;
|
||||
std::vector<cpp_bin_float_100> full_results;
|
||||
|
||||
@@ -229,4 +229,4 @@ value = 2, cube root =1.25992104989487
|
||||
value = 2, cube root =1.2599210498948731647672106072782283505702514647015
|
||||
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -141,7 +141,7 @@ struct root_info
|
||||
std::vector<int> times; // arbirary units (ticks).
|
||||
//boost::int_least64_t min_time = std::numeric_limits<boost::int_least64_t>::max(); // Used to normalize times (as int).
|
||||
std::vector<double> normed_times;
|
||||
int min_time = std::numeric_limits<int>::max(); // Used to normalize times.
|
||||
int min_time = (std::numeric_limits<int>::max)(); // Used to normalize times.
|
||||
std::vector<uintmax_t> iterations;
|
||||
std::vector<long int> distances;
|
||||
std::vector<cpp_bin_float_100> full_results;
|
||||
|
||||
@@ -117,7 +117,7 @@ inline RealType pdf(const exponential_distribution<RealType, Policy>& dist, cons
|
||||
return result;
|
||||
// Workaround for VC11/12 bug:
|
||||
if ((boost::math::isinf)(x))
|
||||
return 0;
|
||||
return 0;
|
||||
result = lambda * exp(-lambda * x);
|
||||
return result;
|
||||
} // pdf
|
||||
@@ -178,7 +178,7 @@ inline RealType cdf(const complemented2_type<exponential_distribution<RealType,
|
||||
return result;
|
||||
// Workaround for VC11/12 bug:
|
||||
if (c.param >= tools::max_value<RealType>())
|
||||
return 0;
|
||||
return 0;
|
||||
result = exp(-c.param * lambda);
|
||||
|
||||
return result;
|
||||
|
||||
@@ -442,7 +442,7 @@ namespace boost
|
||||
// noncentral chi squared", Biometrika 46: 364.
|
||||
// See also:
|
||||
// "A comparison of approximations to percentiles of the noncentral chi2-distribution",
|
||||
// Hardeo Sahai and Mario Miguel Ojeda, Revista de Matematica: Teoria y Aplicaciones 2003 10(1–2) : 57–76.
|
||||
// Hardeo Sahai and Mario Miguel Ojeda, Revista de Matematica: Teoria y Aplicaciones 2003 10(1-2) : 57-76.
|
||||
// Note that the latter reference refers to an approximation of the CDF, when they really mean the quantile.
|
||||
//
|
||||
value_type b = -(l * l) / (k + 3 * l);
|
||||
|
||||
@@ -182,7 +182,7 @@ inline RealType cdf(const complemented2_type<rayleigh_distribution<RealType, Pol
|
||||
RealType ea = x * x / (2 * sigma * sigma);
|
||||
// Fix for VC11/12 x64 bug in exp(float):
|
||||
if (ea >= tools::max_value<RealType>())
|
||||
return 0;
|
||||
return 0;
|
||||
result = exp(-ea);
|
||||
return result;
|
||||
} // cdf complement
|
||||
|
||||
@@ -505,7 +505,7 @@
|
||||
// would mean setting the limit to ~ 1 / n,
|
||||
// but we can tolerate a small amount of divergence:
|
||||
//
|
||||
T small_x_limit = std::min(T(T(5) / n), T(0.25f));
|
||||
T small_x_limit = (std::min)(T(T(5) / n), T(0.25f));
|
||||
if(x < small_x_limit)
|
||||
{
|
||||
return polygamma_nearzero(n, x, pol, function);
|
||||
|
||||
@@ -162,7 +162,7 @@ T gamma_imp(T z, const Policy& pol, const Lanczos& l)
|
||||
{
|
||||
if (z < 1 / tools::max_value<T>())
|
||||
result = policies::raise_overflow_error<T>(function, 0, pol);
|
||||
result *= 1 / z - constants::euler<T>();
|
||||
result *= 1 / z - constants::euler<T>();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -238,13 +238,13 @@ T lgamma_imp(T z, const Policy& pol, const Lanczos& l, int* sign = 0)
|
||||
}
|
||||
else if (z < tools::root_epsilon<T>())
|
||||
{
|
||||
if (0 == z)
|
||||
return policies::raise_pole_error<T>(function, "Evaluation of lgamma at %1%.", z, pol);
|
||||
if (0 == z)
|
||||
return policies::raise_pole_error<T>(function, "Evaluation of lgamma at %1%.", z, pol);
|
||||
if (fabs(z) < 1 / tools::max_value<T>())
|
||||
result = -log(fabs(z));
|
||||
else
|
||||
result = log(fabs(1 / z - constants::euler<T>()));
|
||||
if (z < 0)
|
||||
result = log(fabs(1 / z - constants::euler<T>()));
|
||||
if (z < 0)
|
||||
sresult = -1;
|
||||
}
|
||||
else if(z < 15)
|
||||
@@ -526,9 +526,9 @@ T lgamma_imp(T z, const Policy& pol, const lanczos::undefined_lanczos&, int* sig
|
||||
|
||||
if (zz < min_arg_for_recursion)
|
||||
{
|
||||
// Here we simply take the logarithm of tgamma(). This is somewhat
|
||||
// inefficient, but simple. The rationale is that the argument here
|
||||
// is relatively small and overflow is not expected to be likely.
|
||||
// Here we simply take the logarithm of tgamma(). This is somewhat
|
||||
// inefficient, but simple. The rationale is that the argument here
|
||||
// is relatively small and overflow is not expected to be likely.
|
||||
if (z > -tools::root_epsilon<T>())
|
||||
{
|
||||
// Reflection formula may fail if z is very close to zero, let the series
|
||||
@@ -540,7 +540,7 @@ T lgamma_imp(T z, const Policy& pol, const lanczos::undefined_lanczos&, int* sig
|
||||
}
|
||||
return log_gamma_value;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// No issue with spurious overflow in reflection formula,
|
||||
// just fall through to regular code:
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
// unit test file acosh.hpp for the special functions test suite
|
||||
|
||||
// (C) Copyright Hubert Holin 2003.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#include <boost/math/special_functions/acosh.hpp>
|
||||
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
||||
template<typename T>
|
||||
T acosh_error_evaluator(T x)
|
||||
{
|
||||
using ::std::abs;
|
||||
using ::std::sinh;
|
||||
using ::std::cosh;
|
||||
|
||||
using ::std::numeric_limits;
|
||||
|
||||
using ::boost::math::acosh;
|
||||
|
||||
|
||||
static T const epsilon = numeric_limits<float>::epsilon();
|
||||
|
||||
T y = cosh(x);
|
||||
T z = acosh(y);
|
||||
|
||||
T absolute_error = abs(z-abs(x));
|
||||
T relative_error = absolute_error*abs(sinh(x));
|
||||
T scaled_error = relative_error/epsilon;
|
||||
|
||||
return(scaled_error);
|
||||
}
|
||||
|
||||
|
||||
BOOST_TEST_CASE_TEMPLATE_FUNCTION(acosh_test, T)
|
||||
{
|
||||
BOOST_TEST_MESSAGE("Testing acosh in the real domain for "
|
||||
<< string_type_name<T>::_() << ".");
|
||||
|
||||
for (int i = 0; i <= 100; i++)
|
||||
{
|
||||
T x = static_cast<T>(i-50)/static_cast<T>(5);
|
||||
|
||||
BOOST_CHECK_PREDICATE(::std::less_equal<T>(),
|
||||
(acosh_error_evaluator(x))
|
||||
(static_cast<T>(4)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void acosh_manual_check()
|
||||
{
|
||||
BOOST_TEST_MESSAGE(" ");
|
||||
BOOST_TEST_MESSAGE("acosh");
|
||||
|
||||
for (int i = 0; i <= 100; i++)
|
||||
{
|
||||
float xf = static_cast<float>(i-50)/static_cast<float>(5);
|
||||
double xd = static_cast<double>(i-50)/static_cast<double>(5);
|
||||
long double xl =
|
||||
static_cast<long double>(i-50)/static_cast<long double>(5);
|
||||
|
||||
BOOST_TEST_MESSAGE( ::std::setw(15)
|
||||
<< acosh_error_evaluator(xf)
|
||||
<< ::std::setw(15)
|
||||
<< acosh_error_evaluator(xd)
|
||||
<< ::std::setw(15)
|
||||
<< acosh_error_evaluator(xl));
|
||||
}
|
||||
|
||||
BOOST_TEST_MESSAGE(" ");
|
||||
}
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
// unit test file asinh.hpp for the special functions test suite
|
||||
|
||||
// (C) Copyright Hubert Holin 2003.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#include <boost/math/special_functions/asinh.hpp>
|
||||
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
||||
template<typename T>
|
||||
T asinh_error_evaluator(T x)
|
||||
{
|
||||
using ::std::abs;
|
||||
using ::std::sinh;
|
||||
using ::std::cosh;
|
||||
|
||||
using ::std::numeric_limits;
|
||||
|
||||
using ::boost::math::asinh;
|
||||
|
||||
|
||||
static T const epsilon = numeric_limits<float>::epsilon();
|
||||
|
||||
T y = sinh(x);
|
||||
T z = asinh(y);
|
||||
|
||||
T absolute_error = abs(z-x);
|
||||
T relative_error = absolute_error*cosh(x);
|
||||
T scaled_error = relative_error/epsilon;
|
||||
|
||||
return(scaled_error);
|
||||
}
|
||||
|
||||
|
||||
BOOST_TEST_CASE_TEMPLATE_FUNCTION(asinh_test, T)
|
||||
{
|
||||
BOOST_TEST_MESSAGE("Testing asinh in the real domain for "
|
||||
<< string_type_name<T>::_() << ".");
|
||||
|
||||
for (int i = 0; i <= 100; i++)
|
||||
{
|
||||
T x = static_cast<T>(i-50)/static_cast<T>(5);
|
||||
|
||||
BOOST_CHECK_PREDICATE(::std::less_equal<T>(),
|
||||
(asinh_error_evaluator(x))
|
||||
(static_cast<T>(4)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void asinh_manual_check()
|
||||
{
|
||||
BOOST_TEST_MESSAGE(" ");
|
||||
BOOST_TEST_MESSAGE("asinh");
|
||||
|
||||
for (int i = 0; i <= 100; i++)
|
||||
{
|
||||
float xf = static_cast<float>(i-50)/static_cast<float>(5);
|
||||
double xd = static_cast<double>(i-50)/static_cast<double>(5);
|
||||
long double xl =
|
||||
static_cast<long double>(i-50)/static_cast<long double>(5);
|
||||
|
||||
BOOST_TEST_MESSAGE( ::std::setw(15)
|
||||
<< asinh_error_evaluator(xf)
|
||||
<< ::std::setw(15)
|
||||
<< asinh_error_evaluator(xd)
|
||||
<< ::std::setw(15)
|
||||
<< asinh_error_evaluator(xl));
|
||||
}
|
||||
|
||||
BOOST_TEST_MESSAGE(" ");
|
||||
}
|
||||
|
||||
@@ -1,158 +0,0 @@
|
||||
// unit test file atanh.hpp for the special functions test suite
|
||||
|
||||
// (C) Copyright Hubert Holin 2003.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
//#include <iostream>
|
||||
|
||||
|
||||
#include <boost/math/special_functions/atanh.hpp>
|
||||
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
template<typename T>
|
||||
T atanh_error_evaluator(T x)
|
||||
{
|
||||
using ::std::abs;
|
||||
using ::std::tanh;
|
||||
using ::std::cosh;
|
||||
|
||||
using ::std::numeric_limits;
|
||||
|
||||
using ::boost::math::atanh;
|
||||
|
||||
|
||||
static T const epsilon = numeric_limits<float>::epsilon();
|
||||
|
||||
T y = tanh(x);
|
||||
T z = atanh(y);
|
||||
|
||||
T absolute_error = abs(z-x);
|
||||
T relative_error = absolute_error/(cosh(x)*cosh(x));
|
||||
T scaled_error = relative_error/epsilon;
|
||||
|
||||
return(scaled_error);
|
||||
}
|
||||
|
||||
|
||||
BOOST_TEST_CASE_TEMPLATE_FUNCTION(atanh_test, T)
|
||||
{
|
||||
using ::std::abs;
|
||||
using ::std::tanh;
|
||||
using ::std::log;
|
||||
|
||||
using ::std::numeric_limits;
|
||||
|
||||
using ::boost::math::atanh;
|
||||
|
||||
|
||||
BOOST_TEST_MESSAGE("Testing atanh in the real domain for "
|
||||
<< string_type_name<T>::_() << ".");
|
||||
|
||||
BOOST_CHECK_PREDICATE(::std::less_equal<T>(),
|
||||
(abs(atanh<T>(static_cast<T>(0))))
|
||||
(numeric_limits<T>::epsilon()));
|
||||
|
||||
BOOST_CHECK_PREDICATE(::std::less_equal<T>(),
|
||||
(abs(atanh<T>(static_cast<T>(3)/5) - log(static_cast<T>(2))))
|
||||
(numeric_limits<T>::epsilon()));
|
||||
|
||||
BOOST_CHECK_PREDICATE(::std::less_equal<T>(),
|
||||
(abs(atanh<T>(static_cast<T>(-3)/5) + log(static_cast<T>(2))))
|
||||
(numeric_limits<T>::epsilon()));
|
||||
|
||||
for (int i = 0; i <= 100; i++)
|
||||
{
|
||||
T x = static_cast<T>(i-50)/static_cast<T>(5);
|
||||
T y = tanh(x);
|
||||
|
||||
if (
|
||||
(abs(y-static_cast<T>(1)) >= numeric_limits<T>::epsilon())&&
|
||||
(abs(y+static_cast<T>(1)) >= numeric_limits<T>::epsilon())
|
||||
)
|
||||
{
|
||||
BOOST_CHECK_PREDICATE(::std::less_equal<T>(),
|
||||
(atanh_error_evaluator(x))
|
||||
(static_cast<T>(4)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void atanh_manual_check()
|
||||
{
|
||||
using ::std::abs;
|
||||
using ::std::tanh;
|
||||
|
||||
using ::std::numeric_limits;
|
||||
|
||||
|
||||
BOOST_TEST_MESSAGE(" ");
|
||||
BOOST_TEST_MESSAGE("atanh");
|
||||
|
||||
for (int i = 0; i <= 100; i++)
|
||||
{
|
||||
float xf = static_cast<float>(i-50)/static_cast<float>(5);
|
||||
double xd = static_cast<double>(i-50)/static_cast<double>(5);
|
||||
long double xl =
|
||||
static_cast<long double>(i-50)/static_cast<long double>(5);
|
||||
|
||||
float yf = tanh(xf);
|
||||
double yd = tanh(xd);
|
||||
(void) &yd; // avoid "unused variable" warning
|
||||
long double yl = tanh(xl);
|
||||
(void) &yl; // avoid "unused variable" warning
|
||||
|
||||
if (
|
||||
std::numeric_limits<float>::has_infinity &&
|
||||
std::numeric_limits<double>::has_infinity &&
|
||||
std::numeric_limits<long double>::has_infinity
|
||||
)
|
||||
{
|
||||
BOOST_TEST_MESSAGE( ::std::setw(15)
|
||||
<< atanh_error_evaluator(xf)
|
||||
<< ::std::setw(15)
|
||||
<< atanh_error_evaluator(xd)
|
||||
<< ::std::setw(15)
|
||||
<< atanh_error_evaluator(xl));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (
|
||||
(abs(yf-static_cast<float>(1)) <
|
||||
numeric_limits<float>::epsilon())||
|
||||
(abs(yf+static_cast<float>(1)) <
|
||||
numeric_limits<float>::epsilon())||
|
||||
(abs(yf-static_cast<double>(1)) <
|
||||
numeric_limits<double>::epsilon())||
|
||||
(abs(yf+static_cast<double>(1)) <
|
||||
numeric_limits<double>::epsilon())||
|
||||
(abs(yf-static_cast<long double>(1)) <
|
||||
numeric_limits<long double>::epsilon())||
|
||||
(abs(yf+static_cast<long double>(1)) <
|
||||
numeric_limits<long double>::epsilon())
|
||||
)
|
||||
{
|
||||
BOOST_TEST_MESSAGE("Platform's numerics may lack precision.");
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_TEST_MESSAGE( ::std::setw(15)
|
||||
<< atanh_error_evaluator(xf)
|
||||
<< ::std::setw(15)
|
||||
<< atanh_error_evaluator(xd)
|
||||
<< ::std::setw(15)
|
||||
<< atanh_error_evaluator(xl));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_TEST_MESSAGE(" ");
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1022 B |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1022 B |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 686 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 997 B |
|
Before Width: | Height: | Size: 687 B |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 7.2 KiB |
@@ -1,32 +0,0 @@
|
||||
Results of special functions test.
|
||||
|
||||
(C) Copyright Hubert Holin 2003-2005.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
Running 21 test cases...
|
||||
Testing atanh in the real domain for float.
|
||||
Testing atanh in the real domain for double.
|
||||
Testing atanh in the real domain for long double.
|
||||
Testing asinh in the real domain for float.
|
||||
Testing asinh in the real domain for double.
|
||||
Testing asinh in the real domain for long double.
|
||||
Testing acosh in the real domain for float.
|
||||
Testing acosh in the real domain for double.
|
||||
Testing acosh in the real domain for long double.
|
||||
Testing sinc_pi in the real domain for float.
|
||||
Testing sinc_pi in the real domain for double.
|
||||
Testing sinc_pi in the real domain for long double.
|
||||
Testing sinhc_pi in the real domain for float.
|
||||
Testing sinhc_pi in the real domain for double.
|
||||
Testing sinhc_pi in the real domain for long double.
|
||||
Testing sinc_pi in the complex domain for float.
|
||||
Testing sinc_pi in the complex domain for double.
|
||||
Testing sinc_pi in the complex domain for long double.
|
||||
Testing sinhc_pi in the complex domain for float.
|
||||
Testing sinhc_pi in the complex domain for double.
|
||||
Testing sinhc_pi in the complex domain for long double.
|
||||
|
||||
*** No errors detected
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
// unit test file sinc.hpp for the special functions test suite
|
||||
|
||||
// (C) Copyright Hubert Holin 2003.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <complex>
|
||||
|
||||
|
||||
#include <boost/math/special_functions/sinc.hpp>
|
||||
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
||||
BOOST_TEST_CASE_TEMPLATE_FUNCTION(sinc_pi_test, T)
|
||||
{
|
||||
using ::std::abs;
|
||||
|
||||
using ::std::numeric_limits;
|
||||
|
||||
using ::boost::math::sinc_pi;
|
||||
|
||||
|
||||
BOOST_TEST_MESSAGE("Testing sinc_pi in the real domain for "
|
||||
<< string_type_name<T>::_() << ".");
|
||||
|
||||
BOOST_CHECK_PREDICATE(::std::less_equal<T>(),
|
||||
(abs(sinc_pi<T>(static_cast<T>(0))-static_cast<T>(1)))
|
||||
(numeric_limits<T>::epsilon()));
|
||||
}
|
||||
|
||||
|
||||
BOOST_TEST_CASE_TEMPLATE_FUNCTION(sinc_pi_complex_test, T)
|
||||
{
|
||||
using ::std::abs;
|
||||
using ::std::sinh;
|
||||
|
||||
using ::std::numeric_limits;
|
||||
|
||||
using ::boost::math::sinc_pi;
|
||||
|
||||
|
||||
BOOST_TEST_MESSAGE("Testing sinc_pi in the complex domain for "
|
||||
<< string_type_name<T>::_() << ".");
|
||||
|
||||
BOOST_CHECK_PREDICATE(::std::less_equal<T>(),
|
||||
(abs(sinc_pi<T>(::std::complex<T>(0, 1))-
|
||||
::std::complex<T>(sinh(static_cast<T>(1)))))
|
||||
(numeric_limits<T>::epsilon()));
|
||||
}
|
||||
|
||||
|
||||
void sinc_pi_manual_check()
|
||||
{
|
||||
using ::boost::math::sinc_pi;
|
||||
|
||||
|
||||
BOOST_TEST_MESSAGE(" ");
|
||||
BOOST_TEST_MESSAGE("sinc_pi");
|
||||
|
||||
for (int i = 0; i <= 100; i++)
|
||||
{
|
||||
BOOST_TEST_MESSAGE( ::std::setw(15)
|
||||
<< sinc_pi<float>(static_cast<float>(i-50)/
|
||||
static_cast<float>(50))
|
||||
<< ::std::setw(15)
|
||||
<< sinc_pi<double>(static_cast<double>(i-50)/
|
||||
static_cast<double>(50))
|
||||
<< ::std::setw(15)
|
||||
<< sinc_pi<long double>(static_cast<long double>(i-50)/
|
||||
static_cast<long double>(50)));
|
||||
}
|
||||
|
||||
BOOST_TEST_MESSAGE(" ");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
// unit test file sinhc.hpp for the special functions test suite
|
||||
|
||||
// (C) Copyright Hubert Holin 2003.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <complex>
|
||||
|
||||
|
||||
#include <boost/math/special_functions/sinhc.hpp>
|
||||
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
||||
BOOST_TEST_CASE_TEMPLATE_FUNCTION(sinhc_pi_test, T)
|
||||
{
|
||||
using ::std::abs;
|
||||
|
||||
using ::std::numeric_limits;
|
||||
|
||||
using ::boost::math::sinhc_pi;
|
||||
|
||||
|
||||
BOOST_TEST_MESSAGE("Testing sinhc_pi in the real domain for "
|
||||
<< string_type_name<T>::_() << ".");
|
||||
|
||||
BOOST_CHECK_PREDICATE(::std::less_equal<T>(),
|
||||
(abs(sinhc_pi<T>(static_cast<T>(0))-static_cast<T>(1)))
|
||||
(numeric_limits<T>::epsilon()));
|
||||
}
|
||||
|
||||
|
||||
BOOST_TEST_CASE_TEMPLATE_FUNCTION(sinhc_pi_complex_test, T)
|
||||
{
|
||||
using ::std::abs;
|
||||
using ::std::sin;
|
||||
|
||||
using ::std::numeric_limits;
|
||||
|
||||
using ::boost::math::sinhc_pi;
|
||||
|
||||
|
||||
BOOST_TEST_MESSAGE("Testing sinhc_pi in the complex domain for "
|
||||
<< string_type_name<T>::_() << ".");
|
||||
|
||||
BOOST_CHECK_PREDICATE(::std::less_equal<T>(),
|
||||
(abs(sinhc_pi<T>(::std::complex<T>(0, 1))-
|
||||
::std::complex<T>(sin(static_cast<T>(1)))))
|
||||
(numeric_limits<T>::epsilon()));
|
||||
}
|
||||
|
||||
|
||||
void sinhc_pi_manual_check()
|
||||
{
|
||||
using ::boost::math::sinhc_pi;
|
||||
|
||||
|
||||
BOOST_TEST_MESSAGE(" ");
|
||||
BOOST_TEST_MESSAGE("sinc_pi");
|
||||
|
||||
for (int i = 0; i <= 100; i++)
|
||||
{
|
||||
BOOST_TEST_MESSAGE( ::std::setw(15)
|
||||
<< sinhc_pi<float>(static_cast<float>(i-50)/
|
||||
static_cast<float>(50))
|
||||
<< ::std::setw(15)
|
||||
<< sinhc_pi<double>(static_cast<double>(i-50)/
|
||||
static_cast<double>(50))
|
||||
<< ::std::setw(15)
|
||||
<< sinhc_pi<long double>(static_cast<long double>(i-50)/
|
||||
static_cast<long double>(50)));
|
||||
}
|
||||
|
||||
BOOST_TEST_MESSAGE(" ");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
// test file for special functions.
|
||||
|
||||
// (C) Copyright Hubert Holin 2003.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
|
||||
#include <boost/mpl/list.hpp>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/unit_test_log.hpp>
|
||||
|
||||
template<typename T>
|
||||
struct string_type_name;
|
||||
|
||||
#define DEFINE_TYPE_NAME(Type) \
|
||||
template<> struct string_type_name<Type> \
|
||||
{ \
|
||||
static char const * _() \
|
||||
{ \
|
||||
return #Type; \
|
||||
} \
|
||||
}
|
||||
|
||||
DEFINE_TYPE_NAME(float);
|
||||
DEFINE_TYPE_NAME(double);
|
||||
DEFINE_TYPE_NAME(long double);
|
||||
|
||||
|
||||
typedef boost::mpl::list<float,double,long double> test_types;
|
||||
|
||||
// Apple GCC 4.0 uses the "double double" format for its long double,
|
||||
// which means that epsilon is VERY small but useless for
|
||||
// comparisons. So, don't do those comparisons.
|
||||
#if defined(__APPLE_CC__) && defined(__GNUC__) && __GNUC__ == 4
|
||||
typedef boost::mpl::list<float,double> near_eps_test_types;
|
||||
#else
|
||||
typedef boost::mpl::list<float,double,long double> near_eps_test_types;
|
||||
#endif
|
||||
|
||||
#include "sinc_test.hpp"
|
||||
#include "sinhc_test.hpp"
|
||||
#include "atanh_test.hpp"
|
||||
#include "asinh_test.hpp"
|
||||
#include "acosh_test.hpp"
|
||||
|
||||
|
||||
|
||||
boost::unit_test::test_suite * init_unit_test_suite(int, char *[])
|
||||
{
|
||||
::boost::unit_test::unit_test_log.
|
||||
set_threshold_level(::boost::unit_test::log_messages);
|
||||
|
||||
boost::unit_test::test_suite * test =
|
||||
BOOST_TEST_SUITE("special_functions_test");
|
||||
|
||||
BOOST_TEST_MESSAGE("Results of special functions test.");
|
||||
BOOST_TEST_MESSAGE(" ");
|
||||
BOOST_TEST_MESSAGE("(C) Copyright Hubert Holin 2003-2005.");
|
||||
BOOST_TEST_MESSAGE("Distributed under the Boost Software License, Version 1.0.");
|
||||
BOOST_TEST_MESSAGE("(See accompanying file LICENSE_1_0.txt or copy at");
|
||||
BOOST_TEST_MESSAGE("http://www.boost.org/LICENSE_1_0.txt)");
|
||||
BOOST_TEST_MESSAGE(" ");
|
||||
|
||||
#define BOOST_SPECIAL_FUNCTIONS_COMMON_GENERATOR(fct) \
|
||||
test->add(BOOST_TEST_CASE_TEMPLATE(fct##_test, test_types));
|
||||
|
||||
#define BOOST_SPECIAL_FUNCTIONS_COMMON_GENERATOR_NEAR_EPS(fct) \
|
||||
test->add(BOOST_TEST_CASE_TEMPLATE(fct##_test, near_eps_test_types));
|
||||
|
||||
|
||||
#define BOOST_SPECIAL_FUNCTIONS_COMMON_TEST \
|
||||
BOOST_SPECIAL_FUNCTIONS_COMMON_GENERATOR(atanh) \
|
||||
BOOST_SPECIAL_FUNCTIONS_COMMON_GENERATOR(asinh) \
|
||||
BOOST_SPECIAL_FUNCTIONS_COMMON_GENERATOR(acosh) \
|
||||
BOOST_SPECIAL_FUNCTIONS_COMMON_GENERATOR(sinc_pi) \
|
||||
BOOST_SPECIAL_FUNCTIONS_COMMON_GENERATOR(sinhc_pi)
|
||||
|
||||
#define BOOST_SPECIAL_FUNCTIONS_TEMPLATE_TEMPLATE_TEST \
|
||||
BOOST_SPECIAL_FUNCTIONS_COMMON_GENERATOR_NEAR_EPS(sinc_pi_complex) \
|
||||
BOOST_SPECIAL_FUNCTIONS_COMMON_GENERATOR_NEAR_EPS(sinhc_pi_complex)
|
||||
|
||||
|
||||
#ifdef BOOST_NO_TEMPLATE_TEMPLATES
|
||||
|
||||
#define BOOST_SPECIAL_FUNCTIONS_TEST \
|
||||
BOOST_SPECIAL_FUNCTIONS_COMMON_TEST \
|
||||
BOOST_TEST_MESSAGE("Warning: no template templates; curtailed functionality.");
|
||||
|
||||
#else /* BOOST_NO_TEMPLATE_TEMPLATES */
|
||||
|
||||
#define BOOST_SPECIAL_FUNCTIONS_TEST \
|
||||
BOOST_SPECIAL_FUNCTIONS_COMMON_TEST \
|
||||
BOOST_SPECIAL_FUNCTIONS_TEMPLATE_TEMPLATE_TEST
|
||||
|
||||
#endif /* BOOST_NO_TEMPLATE_TEMPLATES */
|
||||
|
||||
|
||||
BOOST_SPECIAL_FUNCTIONS_TEST
|
||||
|
||||
|
||||
#undef BOOST_SPECIAL_FUNCTIONS_TEST
|
||||
|
||||
#undef BOOST_SPECIAL_FUNCTIONS_TEMPLATE_TEMPLATE_TEST
|
||||
|
||||
#undef BOOST_SPECIAL_FUNCTIONS_COMMON_TEST
|
||||
|
||||
#undef BOOST_SPECIAL_FUNCTIONS_COMMON_GENERATOR
|
||||
|
||||
#undef BOOST_SPECIAL_FUNCTIONS_COMMON_GENERATOR_NEAR_EPS
|
||||
|
||||
#ifdef BOOST_SPECIAL_FUNCTIONS_TEST_VERBOSE
|
||||
|
||||
using ::std::numeric_limits;
|
||||
|
||||
BOOST_TEST_MESSAGE("epsilon");
|
||||
|
||||
BOOST_TEST_MESSAGE( ::std::setw(15) << numeric_limits<float>::epsilon()
|
||||
<< ::std::setw(15) << numeric_limits<double>::epsilon()
|
||||
<< ::std::setw(15) << numeric_limits<long double>::epsilon());
|
||||
|
||||
BOOST_TEST_MESSAGE(" ");
|
||||
|
||||
test->add(BOOST_TEST_CASE(atanh_manual_check));
|
||||
test->add(BOOST_TEST_CASE(asinh_manual_check));
|
||||
test->add(BOOST_TEST_CASE(acosh_manual_check));
|
||||
test->add(BOOST_TEST_CASE(sinc_pi_manual_check));
|
||||
test->add(BOOST_TEST_CASE(sinhc_pi_manual_check));
|
||||
|
||||
#endif /* BOOST_SPECIAL_FUNCTIONS_TEST_VERBOSE */
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
#undef DEFINE_TYPE_NAME
|
||||