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

Improve 0F1, 1F0 and 1F1 coverage.

This commit is contained in:
jzmaddock
2024-07-13 20:04:46 +01:00
parent 6440f731b1
commit ba6838ce07
9 changed files with 185 additions and 124 deletions

View File

@@ -64,9 +64,7 @@ namespace boost { namespace math { namespace detail {
return T(1); return T(1);
if ((b <= 0) && (b == floor(b))) if ((b <= 0) && (b == floor(b)))
return policies::raise_pole_error<T>( return policies::raise_pole_error<T>(function, "Evaluation of 0f1 with nonpositive integer b = %1%.", b, pol);
function,
"Evaluation of 0f1 with nonpositive integer b = %1%.", b, pol);
if (z < -5 && b > -5) if (z < -5 && b > -5)
{ {

View File

@@ -25,16 +25,11 @@ inline T hypergeometric_1F0_imp(const T& a, const T& z, const Policy& pol)
BOOST_MATH_STD_USING // pow BOOST_MATH_STD_USING // pow
if (z == 1) if (z == 1)
return policies::raise_pole_error<T>( return policies::raise_pole_error<T>(function, "Evaluation of 1F0 with z = %1%.", z, pol);
function,
"Evaluation of 1F0 with z = %1%.",
z,
pol);
if (1 - z < 0) if (1 - z < 0)
{ {
if (floor(a) != a) if (floor(a) != a)
return policies::raise_domain_error<T>(function, return policies::raise_domain_error<T>(function, "Result is complex when a is non-integral and z > 1, but got z = %1%", z, pol);
"Result is complex when a is non-integral and z > 1, but got z = %1%", z, pol);
} }
// more naive and convergent method than series // more naive and convergent method than series
return pow(T(1 - z), T(-a)); return pow(T(1 - z), T(-a));

View File

@@ -80,7 +80,8 @@ namespace boost { namespace math { namespace detail {
if (a < 0) if (a < 0)
{ {
if ((b < a) && (z < -b / 4)) if ((b < a) && (z < -b / 4))
return hypergeometric_1F1_from_function_ratio_negative_ab(a, b, z, pol, log_scaling); // Defensive programming: it is *almost* certain that we can never get here, proving that is hard though...
return hypergeometric_1F1_from_function_ratio_negative_ab(a, b, z, pol, log_scaling); // LCOV_EXCL_LINE
else else
{ {
// //
@@ -123,6 +124,7 @@ namespace boost { namespace math { namespace detail {
{ {
if (boost::math::policies::digits<T, Policy>() <= 64) if (boost::math::policies::digits<T, Policy>() <= 64)
return hypergeometric_1F1_from_function_ratio_negative_b_forwards(a, b, z, pol, log_scaling); return hypergeometric_1F1_from_function_ratio_negative_b_forwards(a, b, z, pol, log_scaling);
// LCOV_EXCL_START, what follows is multiprecision only
#ifndef BOOST_MATH_NO_EXCEPTIONS #ifndef BOOST_MATH_NO_EXCEPTIONS
try try
#endif #endif
@@ -138,6 +140,7 @@ namespace boost { namespace math { namespace detail {
return hypergeometric_1F1_from_function_ratio_negative_b_forwards(a, b, z, pol, log_scaling); return hypergeometric_1F1_from_function_ratio_negative_b_forwards(a, b, z, pol, log_scaling);
} }
#endif #endif
// LCOV_EXCL_END
} }
// //
// We could fall back to Tricomi's approximation if we're in the transition zone // We could fall back to Tricomi's approximation if we're in the transition zone
@@ -160,6 +163,8 @@ namespace boost { namespace math { namespace detail {
return hypergeometric_1F1_checked_series_impl(a, b, z, pol, log_scaling); return hypergeometric_1F1_checked_series_impl(a, b, z, pol, log_scaling);
} }
#if 0
// Archived, not used, see comments at call site.
template <class T> template <class T>
bool is_convergent_negative_z_series(const T& a, const T& b, const T& z, const T& b_minus_a) bool is_convergent_negative_z_series(const T& a, const T& b, const T& z, const T& b_minus_a)
{ {
@@ -180,7 +185,7 @@ namespace boost { namespace math { namespace detail {
// Double check for divergence when we cross the origin on a and b: // Double check for divergence when we cross the origin on a and b:
if (a < 0) if (a < 0)
{ {
T n = 300 - floor(a); T n = 3 - floor(a);
if (fabs((a + n) * z / ((b + n) * n)) < 1) if (fabs((a + n) * z / ((b + n) * n)) < 1)
{ {
if (b < 0) if (b < 0)
@@ -225,7 +230,7 @@ namespace boost { namespace math { namespace detail {
} }
return false; return false;
} }
#endif
template <class T> template <class T>
inline T cyl_bessel_i_shrinkage_rate(const T& z) inline T cyl_bessel_i_shrinkage_rate(const T& z)
{ {
@@ -313,11 +318,7 @@ namespace boost { namespace math { namespace detail {
// undefined result: // undefined result:
if (!detail::check_hypergeometric_1F1_parameters(a, b)) if (!detail::check_hypergeometric_1F1_parameters(a, b))
return policies::raise_domain_error<T>( return policies::raise_domain_error<T>(function, "Function is indeterminate for negative integer b = %1%.", b, pol);
function,
"Function is indeterminate for negative integer b = %1%.",
b,
pol);
// other checks: // other checks:
if (a == -1) if (a == -1)
@@ -444,6 +445,12 @@ namespace boost { namespace math { namespace detail {
{ {
if (a == 1) if (a == 1)
return detail::hypergeometric_1F1_pade(b, z, pol); return detail::hypergeometric_1F1_pade(b, z, pol);
#if 0
//
// Commented out: is_convergent_negative_z_series is fine so far as it goes
// but there appear to be no cases that use it, and in extremis, we will
// fall through to the series evaluation anyway.
//
if (is_convergent_negative_z_series(a, b, z, b_minus_a)) if (is_convergent_negative_z_series(a, b, z, b_minus_a))
{ {
if ((boost::math::sign(b_minus_a) == boost::math::sign(b)) && ((b > 0) || (b < -200))) if ((boost::math::sign(b_minus_a) == boost::math::sign(b)) && ((b > 0) || (b < -200)))
@@ -462,6 +469,7 @@ namespace boost { namespace math { namespace detail {
return hypergeometric_1F1_checked_series_impl(a, b, z, pol, log_scaling); return hypergeometric_1F1_checked_series_impl(a, b, z, pol, log_scaling);
} }
} }
#endif
if ((b < 0) && (floor(b) == b)) if ((b < 0) && (floor(b) == b))
{ {
// Negative integer b, so a must be a negative integer too. // Negative integer b, so a must be a negative integer too.
@@ -673,16 +681,26 @@ namespace boost { namespace math { namespace detail {
while (scale > max_scaling) while (scale > max_scaling)
{ {
if((fabs(result) > 1) && (fabs(tools::max_value<T>()) / result <= max_scale_factor))
return policies::raise_overflow_error<T>("hypergeometric_1F1_regularized", nullptr, pol);
// This is *probably* unreachable:
// LCOV_EXCL_START
result *= max_scale_factor; result *= max_scale_factor;
scale -= max_scaling; scale -= max_scaling;
// LCOV_EXCL_STOP
} }
while (scale < -max_scaling) while (scale < -max_scaling)
{ {
result /= max_scale_factor; result /= max_scale_factor;
scale += max_scaling; scale += max_scaling;
} }
if (scale != 0) if (scale != 0)
result *= exp(scale); {
scale = exp(scale);
if ((scale > 1) && (fabs(result) > 1) && (fabs(tools::max_value<T>() / result) <= scale))
return policies::raise_overflow_error<T>("hypergeometric_1F1_regularized", nullptr, pol);
result *= scale;
}
return result * result_sign; return result * result_sign;
} }

View File

@@ -215,5 +215,11 @@ void test_spots(T, const char* type_name)
do_test_0F1<T>(hypergeometric_0F1_integer_data, type_name, "Integer Arguments"); do_test_0F1<T>(hypergeometric_0F1_integer_data, type_name, "Integer Arguments");
do_test_0F1<T>(hypergeometric_0F1_real_data, type_name, "Real Arguments"); do_test_0F1<T>(hypergeometric_0F1_real_data, type_name, "Real Arguments");
do_test_0F1<T>(hypergeometric_0F1_large_data, type_name, "Large Arguments"); do_test_0F1<T>(hypergeometric_0F1_large_data, type_name, "Large Arguments");
//
// Coverage:
//
BOOST_CHECK_THROW(boost::math::hypergeometric_0F1(static_cast<T>(-1), static_cast<T>(0.5)), std::domain_error);
BOOST_CHECK_THROW(boost::math::hypergeometric_0F1(static_cast<T>(-20), static_cast<T>(0.5)), std::domain_error);
} }

View File

@@ -162,94 +162,94 @@ void test_spots5(T, const char* type_name)
template <class T> template <class T>
void test_spots6(T, const char* type_name) void test_spots6(T, const char* type_name)
{ {
static const std::array<std::array<T, 4>, 186> hypergeometric_1F1_bugs = { { static const std::array<std::array<T, 4>, 188> hypergeometric_1F1_bugs = { {
{ { static_cast<double>(17955.561660766602), static_cast<double>(9.6968994205831605e-09), static_cast<double>(-82.406154185533524), SC_(6.98056008378736714088730927132364938220428678e-11) }}, { { static_cast<T>(17955.561660766602), static_cast<T>(9.6968994205831605e-09), static_cast<T>(-82.406154185533524), SC_(6.98056008378736714088730927132364938220428678e-11) }},
{ { static_cast<double>(17955.561660766602), static_cast<double>(-9.6968994205831605e-09), static_cast<double>(-82.406154185533524), SC_(-6.98055306629610746072607353939306734740549551e-11) }}, { { static_cast<T>(17955.561660766602), static_cast<T>(-9.6968994205831605e-09), static_cast<T>(-82.406154185533524), SC_(-6.98055306629610746072607353939306734740549551e-11) }},
{ { static_cast<double>(-17955.561660766602), static_cast<double>(-9.6968994205831605e-09), static_cast<double>(82.406154185533524), SC_(-42897094853118832762870100.8669248353530950866) }} , { { static_cast<T>(-17955.561660766602), static_cast<T>(-9.6968994205831605e-09), static_cast<T>(82.406154185533524), SC_(-42897094853118832762870100.8669248353530950866) }} ,
{ { static_cast<double>(17955.561660766602), static_cast<double>(17956.061660766602), static_cast<double>(82.406154185533524), SC_(613117565438499794408370861624072730.553215432) }}, { { static_cast<T>(17955.561660766602), static_cast<T>(17956.061660766602), static_cast<T>(82.406154185533524), SC_(613117565438499794408370861624072730.553215432) }},
{ { static_cast<double>(2.9127331452327709e-07), static_cast<double>(-0.99999970872668542), static_cast<double>(0.15018942760070786), SC_(0.987526018990506843793601092932108059727149508) }}, { { static_cast<T>(2.9127331452327709e-07), static_cast<T>(-0.99999970872668542), static_cast<T>(0.15018942760070786), SC_(0.987526018990506843793601092932108059727149508) }},
{ { static_cast<double>(-2.9127331452327709e-07), static_cast<double>(-1.0000002912733146), static_cast<double>(0.15018942760070786), SC_(0.987526120661366412484942089372497015837368389) }}, { { static_cast<T>(-2.9127331452327709e-07), static_cast<T>(-1.0000002912733146), static_cast<T>(0.15018942760070786), SC_(0.987526120661366412484942089372497015837368389) }},
{ { static_cast<double>(6.7191087900739423e-13), static_cast<double>(-0.99999999999932809), static_cast<double>(0.0011913633891253994), SC_(0.999999289758605006762757201699750974296453229) }}, { { static_cast<T>(6.7191087900739423e-13), static_cast<T>(-0.99999999999932809), static_cast<T>(0.0011913633891253994), SC_(0.999999289758605006762757201699750974296453229) }},
{ { static_cast<double>(6.7191087900739423e-13), static_cast<double>(-0.99999999999932809), static_cast<double>(-0.0011913633891253994), SC_(0.999999290885918468326416221021126912154021802) }}, { { static_cast<T>(6.7191087900739423e-13), static_cast<T>(-0.99999999999932809), static_cast<T>(-0.0011913633891253994), SC_(0.999999290885918468326416221021126912154021802) }},
{ { static_cast<double>(-6.7191087900739423e-13), static_cast<double>(-1.0000000000006719), static_cast<double>(0.0011913633891253994), SC_(0.999999289758606609651292394510404091049823243) }}, { { static_cast<T>(-6.7191087900739423e-13), static_cast<T>(-1.0000000000006719), static_cast<T>(0.0011913633891253994), SC_(0.999999289758606609651292394510404091049823243) }},
{ { static_cast<double>(-6.7191087900739423e-13), static_cast<double>(-1.0000000000006719), static_cast<double>(-0.0011913633891253994), SC_(0.999999290885916869252591036674587894145399498) }}, { { static_cast<T>(-6.7191087900739423e-13), static_cast<T>(-1.0000000000006719), static_cast<T>(-0.0011913633891253994), SC_(0.999999290885916869252591036674587894145399498) }},
{ { static_cast<double>(1.2860067365774887e-17), static_cast<double>(6.2442285664031425e-16), static_cast<double>(-2539.60133934021), SC_(0.979404874070484696999110600576068012417904384) }}, { { static_cast<T>(1.2860067365774887e-17), static_cast<T>(6.2442285664031425e-16), static_cast<T>(-2539.60133934021), SC_(0.979404874070484696999110600576068012417904384) }},
{ { static_cast<double>(1.2860067365774887e-17), static_cast<double>(-6.2442285664031425e-16), static_cast<double>(-2539.60133934021), SC_(1.0205951259295150865252112924093487321207727) }}, { { static_cast<T>(1.2860067365774887e-17), static_cast<T>(-6.2442285664031425e-16), static_cast<T>(-2539.60133934021), SC_(1.0205951259295150865252112924093487321207727) }},
{ { static_cast<double>(-1.2860067365774887e-17), static_cast<double>(6.2442285664031425e-16), static_cast<double>(-2539.60133934021), SC_(1.02059512592951530745923325071510441026202975) }}, { { static_cast<T>(-1.2860067365774887e-17), static_cast<T>(6.2442285664031425e-16), static_cast<T>(-2539.60133934021), SC_(1.02059512592951530745923325071510441026202975) }},
{ { static_cast<double>(-1.2860067365774887e-17), static_cast<double>(-6.2442285664031425e-16), static_cast<double>(-2539.60133934021), SC_(0.979404874070484909016444856299500644331897735) }}, { { static_cast<T>(-1.2860067365774887e-17), static_cast<T>(-6.2442285664031425e-16), static_cast<T>(-2539.60133934021), SC_(0.979404874070484909016444856299500644331897735) }},
{ { static_cast<double>(1.2860067365774887e-17), static_cast<double>(1), static_cast<double>(-2539.60133934021), SC_(0.999999999999999891757095137551552220860540801) }}, { { static_cast<T>(1.2860067365774887e-17), static_cast<T>(1), static_cast<T>(-2539.60133934021), SC_(0.999999999999999891757095137551552220860540801) }},
{ { static_cast<double>(-1.2860067365774887e-17), static_cast<double>(1), static_cast<double>(-2539.60133934021), SC_(1.00000000000000010824290486244845922375479178) }}, { { static_cast<T>(-1.2860067365774887e-17), static_cast<T>(1), static_cast<T>(-2539.60133934021), SC_(1.00000000000000010824290486244845922375479178) }},
{ { static_cast<double>(1.2860067365774887e-17), static_cast<double>(0.5), static_cast<double>(-2539.60133934021), SC_(0.999999999999999873931788919689096760455570214) }}, { { static_cast<T>(1.2860067365774887e-17), static_cast<T>(0.5), static_cast<T>(-2539.60133934021), SC_(0.999999999999999873931788919689096760455570214) }},
{ { static_cast<double>(-1.2860067365774887e-17), static_cast<double>(0.5), static_cast<double>(-2539.60133934021), SC_(1.0000000000000001260682110803109183167444166) }}, { { static_cast<T>(-1.2860067365774887e-17), static_cast<T>(0.5), static_cast<T>(-2539.60133934021), SC_(1.0000000000000001260682110803109183167444166) }},
{ { static_cast<double>(1.2860067365774887e-17), static_cast<double>(-0.5), static_cast<double>(-2539.60133934021), SC_(0.999999999999999899656990458526368219886894767) }}, { { static_cast<T>(1.2860067365774887e-17), static_cast<T>(-0.5), static_cast<T>(-2539.60133934021), SC_(0.999999999999999899656990458526368219886894767) }},
{ { static_cast<double>(-1.2860067365774887e-17), static_cast<double>(-0.5), static_cast<double>(-2539.60133934021), SC_(1.00000000000000010034300954147364037131355735) }}, { { static_cast<T>(-1.2860067365774887e-17), static_cast<T>(-0.5), static_cast<T>(-2539.60133934021), SC_(1.00000000000000010034300954147364037131355735) }},
{ { static_cast<double>(1.9561377367172441e-13), static_cast<double>(-0.99999999999980438), static_cast<double>(0.53720525559037924), SC_(0.791950585963666119273677451162365759080483409) }}, { { static_cast<T>(1.9561377367172441e-13), static_cast<T>(-0.99999999999980438), static_cast<T>(0.53720525559037924), SC_(0.791950585963666119273677451162365759080483409) }},
{ { static_cast<double>(1.9561377367172441e-13), static_cast<double>(-0.99999999999980438), static_cast<double>(-0.53720525559037924), SC_(0.898314630992769591673208399706587643905527327) }}, { { static_cast<T>(1.9561377367172441e-13), static_cast<T>(-0.99999999999980438), static_cast<T>(-0.53720525559037924), SC_(0.898314630992769591673208399706587643905527327) }},
{ { static_cast<double>(-1.9561377367172441e-13), static_cast<double>(-1.0000000000001956), static_cast<double>(0.53720525559037924), SC_(0.791950585964025761367113514279915403442035074) }}, { { static_cast<T>(-1.9561377367172441e-13), static_cast<T>(-1.0000000000001956), static_cast<T>(0.53720525559037924), SC_(0.791950585964025761367113514279915403442035074) }},
{ { static_cast<double>(-1.9561377367172441e-13), static_cast<double>(-1.0000000000001956), static_cast<double>(-0.53720525559037924), SC_(0.898314630992646771749564140770704893561753597) }}, { { static_cast<T>(-1.9561377367172441e-13), static_cast<T>(-1.0000000000001956), static_cast<T>(-0.53720525559037924), SC_(0.898314630992646771749564140770704893561753597) }},
{ { static_cast<double>(5.1851756946064858e-12), static_cast<double>(-0.99999999999481481), static_cast<double>(-774.06985878944397), SC_(1.91306610467163858324476828831735612399803649e-06) }}, { { static_cast<T>(5.1851756946064858e-12), static_cast<T>(-0.99999999999481481), static_cast<T>(-774.06985878944397), SC_(1.91306610467163858324476828831735612399803649e-06) }},
{ { static_cast<double>(-5.1851756946064858e-12), static_cast<double>(-1.0000000000051852), static_cast<double>(-774.06985878944397), SC_(1.91306610479516297551035931150910859922270467e-06) }}, { { static_cast<T>(-5.1851756946064858e-12), static_cast<T>(-1.0000000000051852), static_cast<T>(-774.06985878944397), SC_(1.91306610479516297551035931150910859922270467e-06) }},
{{ static_cast<double>(4.782769898853794e-15), static_cast<double>(1.0000000000000049), static_cast<double>(43.289540141820908), SC_(715.678254892476818206948251991084031658534788) }}, {{ static_cast<T>(4.782769898853794e-15), static_cast<T>(1.0000000000000049), static_cast<T>(43.289540141820908), SC_(715.678254892476818206948251991084031658534788) }},
{ { static_cast<double>(-4.782769898853794e-15), static_cast<double>(0.99999999999999523), static_cast<double>(43.289540141820908), SC_(-713.67825489247727251051792450091274703212426) }}, { { static_cast<T>(-4.782769898853794e-15), static_cast<T>(0.99999999999999523), static_cast<T>(43.289540141820908), SC_(-713.67825489247727251051792450091274703212426) }},
{ { static_cast<double>(4.782769898853794e-15), static_cast<double>(0.50000000000000477), static_cast<double>(43.289540141820908), SC_(8235.578376364917373771471380274179857713986) }}, { { static_cast<T>(4.782769898853794e-15), static_cast<T>(0.50000000000000477), static_cast<T>(43.289540141820908), SC_(8235.578376364917373771471380274179857713986) }},
{ { static_cast<double>(-4.782769898853794e-15), static_cast<double>(0.49999999999999523), static_cast<double>(43.289540141820908), SC_(-8233.57837636502669085205930058992320862281194) }}, { { static_cast<T>(-4.782769898853794e-15), static_cast<T>(0.49999999999999523), static_cast<T>(43.289540141820908), SC_(-8233.57837636502669085205930058992320862281194) }},
{ { static_cast<double>(4.782769898853794e-15), static_cast<double>(-0.49999999999999523), static_cast<double>(43.289540141820908), SC_(-696269.800378137841948029488304613132151506346) }}, { { static_cast<T>(4.782769898853794e-15), static_cast<T>(-0.49999999999999523), static_cast<T>(43.289540141820908), SC_(-696269.800378137841948029488304613132151506346) }},
{ { static_cast<double>(-4.782769898853794e-15), static_cast<double>(-0.50000000000000477), static_cast<double>(43.289540141820908), SC_(696271.8003781336298001417038674968935893361) }}, { { static_cast<T>(-4.782769898853794e-15), static_cast<T>(-0.50000000000000477), static_cast<T>(43.289540141820908), SC_(696271.8003781336298001417038674968935893361) }},
{ { static_cast<double>(8.1104991963343309e-05), static_cast<double>(-0.99991889500803666), static_cast<double>(-289.12455415725708), SC_(7.89625448009377635153307897651433007437615965e-124) }}, { { static_cast<T>(8.1104991963343309e-05), static_cast<T>(-0.99991889500803666), static_cast<T>(-289.12455415725708), SC_(7.89625448009377635153307897651433007437615965e-124) }},
{ { static_cast<double>(-8.1104991963343309e-05), static_cast<double>(-1.0000811049919633), static_cast<double>(-289.12455415725708), SC_(7.8949781467741574268884621364833028722017032e-124) }}, { { static_cast<T>(-8.1104991963343309e-05), static_cast<T>(-1.0000811049919633), static_cast<T>(-289.12455415725708), SC_(7.8949781467741574268884621364833028722017032e-124) }},
{{ static_cast<double>(-1.98018241448205767), static_cast<double>(1.98450573845762079), static_cast<double>(54.4977916804564302), SC_(2972026581564772.790187123046255523239732028) }}, {{ static_cast<T>(-1.98018241448205767), static_cast<T>(1.98450573845762079), static_cast<T>(54.4977916804564302), SC_(2972026581564772.790187123046255523239732028) }},
{ { static_cast<double>(-7.8238229420435346e-05), static_cast<double>(-0.50007823822942044), static_cast<double>(-1896.0561106204987), SC_(1.00058778866237037053151236215058095904086972) }}, { { static_cast<T>(-7.8238229420435346e-05), static_cast<T>(-0.50007823822942044), static_cast<T>(-1896.0561106204987), SC_(1.00058778866237037053151236215058095904086972) }},
// Unexpected high error : 2.48268e+91 Found : -9.61305e+268 Expected : -1.74382e+193 // Unexpected high error : 2.48268e+91 Found : -9.61305e+268 Expected : -1.74382e+193
{ { static_cast<double>(5.9981750131794866e-15), static_cast<double>(-230.70702263712883), static_cast<double>(240.42092034220695), SC_(-1.74381782591884817018404492963109914357365958e+193) }}, { { static_cast<T>(5.9981750131794866e-15), static_cast<T>(-230.70702263712883), static_cast<T>(240.42092034220695), SC_(-1.74381782591884817018404492963109914357365958e+193) }},
// Unexpected high error : 1.79769313486231570814527423731704356798070568e+308 Found : -9.61305077326281580724540507004198316499661687e+268 Expected : 1.74381782591870724567837900957146707932623893e+193 // Unexpected high error : 1.79769313486231570814527423731704356798070568e+308 Found : -9.61305077326281580724540507004198316499661687e+268 Expected : 1.74381782591870724567837900957146707932623893e+193
{ { static_cast<double>(-5.9981750131794866e-15), static_cast<double>(-230.70702263712883), static_cast<double>(240.42092034220695), SC_(1.74381782591870734495565763481520223752372107e+193) }}, { { static_cast<T>(-5.9981750131794866e-15), static_cast<T>(-230.70702263712883), static_cast<T>(240.42092034220695), SC_(1.74381782591870734495565763481520223752372107e+193) }},
//Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the result are correct, last result was - 13497.312248525042 //Unexpected exception : Error in function boost::math::hypergeometric_pFq<long T> : Cancellation is so severe that no bits in the result are correct, last result was - 13497.312248525042
{ { static_cast<double>(-0.00023636552788275367), static_cast<double>(0.49976363447211725), static_cast<double>(-55.448519088327885), SC_(1.00141219419064760011631555641142295011268795) }}, { { static_cast<T>(-0.00023636552788275367), static_cast<T>(0.49976363447211725), static_cast<T>(-55.448519088327885), SC_(1.00141219419064760011631555641142295011268795) }},
// Unexpected exception: Error in function boost::math::hypergeometric_pFq<long double>: Cancellation is so severe that no bits in the result are correct, last result was -13497.312248525042 // Unexpected exception: Error in function boost::math::hypergeometric_pFq<long T>: Cancellation is so severe that no bits in the result are correct, last result was -13497.312248525042
{{ static_cast<double>(-0.00023636552788275367), static_cast<double>(-0.50023636552788275), static_cast<double>(-55.448519088327885), SC_(1.00093463146763986302362749764017215184711625) }}, {{ static_cast<T>(-0.00023636552788275367), static_cast<T>(-0.50023636552788275), static_cast<T>(-55.448519088327885), SC_(1.00093463146763986302362749764017215184711625) }},
// Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the result are correct, last result was - 1.3871133003351527e+47 // Unexpected exception : Error in function boost::math::hypergeometric_pFq<long T> : Cancellation is so severe that no bits in the result are correct, last result was - 1.3871133003351527e+47
{ { static_cast<double>(-1.6548533913638905e-10), static_cast<double>(0.49999999983451465), static_cast<double>(-169.20843148231506), SC_(1.00000000117356793527360151094991866549128017) }}, { { static_cast<T>(-1.6548533913638905e-10), static_cast<T>(0.49999999983451465), static_cast<T>(-169.20843148231506), SC_(1.00000000117356793527360151094991866549128017) }},
// Unexpected exception: Error in function boost::math::hypergeometric_pFq<long double>: Cancellation is so severe that no bits in the result are correct, last result was -1.3871133003351527e+47 // Unexpected exception: Error in function boost::math::hypergeometric_pFq<long T>: Cancellation is so severe that no bits in the result are correct, last result was -1.3871133003351527e+47
{{ static_cast<double>(-1.6548533913638905e-10), static_cast<double>(-0.50000000016548529), static_cast<double>(-169.20843148231506), SC_(1.00000000084161045914716192484600809610013447) }}, {{ static_cast<T>(-1.6548533913638905e-10), static_cast<T>(-0.50000000016548529), static_cast<T>(-169.20843148231506), SC_(1.00000000084161045914716192484600809610013447) }},
// Unexpected high error : 17825.7893791562892147339880466461181640625 Found : -0.000253525216373273569459012577453904668800532818 Expected : -0.000253525216374277052779756536082800266740377992 // Unexpected high error : 17825.7893791562892147339880466461181640625 Found : -0.000253525216373273569459012577453904668800532818 Expected : -0.000253525216374277052779756536082800266740377992
{ { static_cast<double>(-2.0211181797563725e-14), static_cast<double>(-1.0000000000000202), static_cast<double>(-25.653068032115698), SC_(-0.000253525216374277055047768086884693917115210113) }}, { { static_cast<T>(-2.0211181797563725e-14), static_cast<T>(-1.0000000000000202), static_cast<T>(-25.653068032115698), SC_(-0.000253525216374277055047768086884693917115210113) }},
// Unexpected high error: 1.79769e+308 Found: -inf Expected: -2.63233e-197 // Unexpected high error: 1.79769e+308 Found: -inf Expected: -2.63233e-197
{{ static_cast<double>(235.44106131792068), static_cast<double>(-2.250966744069919e-13), static_cast<double>(-974.28781914710999), SC_(-2.63233018990922939037251029961929844581862228e-197) }}, {{ static_cast<T>(235.44106131792068), static_cast<T>(-2.250966744069919e-13), static_cast<T>(-974.28781914710999), SC_(-2.63233018990922939037251029961929844581862228e-197) }},
// Unexpected high error : 1.79769313486231570814527423731704356798070568e+308 Found : -inf Expected : -3.53316570137147325345279499243339692001224196e+226 // Unexpected high error : 1.79769313486231570814527423731704356798070568e+308 Found : -inf Expected : -3.53316570137147325345279499243339692001224196e+226
{ { static_cast<double>(-235.44106131792068), static_cast<double>(-2.250966744069919e-13), static_cast<double>(974.28781914710999), SC_(-3.53316570137147343919975579872097464691424847e+226) }}, { { static_cast<T>(-235.44106131792068), static_cast<T>(-2.250966744069919e-13), static_cast<T>(974.28781914710999), SC_(-3.53316570137147343919975579872097464691424847e+226) }},
// Unexpected high error : 2.48268e+91 Found : -9.61305e+268 Expected : -1.74382e+193 // Unexpected high error : 2.48268e+91 Found : -9.61305e+268 Expected : -1.74382e+193
{ { static_cast<double>(5.9981750131794866e-15), static_cast<double>(-230.70702263712883), static_cast<double>(240.42092034220695), SC_(-1.74381782591884817018404492963109914357365958e+193) }}, { { static_cast<T>(5.9981750131794866e-15), static_cast<T>(-230.70702263712883), static_cast<T>(240.42092034220695), SC_(-1.74381782591884817018404492963109914357365958e+193) }},
// Unexpected high error : 1.79769313486231570814527423731704356798070568e+308 Found : -9.61305077326281580724540507004198316499661687e+268 Expected : 1.74381782591870724567837900957146707932623893e+193 // Unexpected high error : 1.79769313486231570814527423731704356798070568e+308 Found : -9.61305077326281580724540507004198316499661687e+268 Expected : 1.74381782591870724567837900957146707932623893e+193
{ { static_cast<double>(-5.9981750131794866e-15), static_cast<double>(-230.70702263712883), static_cast<double>(240.42092034220695), SC_(1.74381782591870734495565763481520223752372107e+193) }}, { { static_cast<T>(-5.9981750131794866e-15), static_cast<T>(-230.70702263712883), static_cast<T>(240.42092034220695), SC_(1.74381782591870734495565763481520223752372107e+193) }},
// Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the result are correct, last result was 3.0871891698197084e+73 // Unexpected exception : Error in function boost::math::hypergeometric_pFq<long T> : Cancellation is so severe that no bits in the result are correct, last result was 3.0871891698197084e+73
{ { static_cast<double>(-5.9981750131794866e-15), static_cast<double>(0.499999999999994), static_cast<double>(-240.42092034220695), SC_(1.00000000000004464930530925572237133417488137) }}, { { static_cast<T>(-5.9981750131794866e-15), static_cast<T>(0.499999999999994), static_cast<T>(-240.42092034220695), SC_(1.00000000000004464930530925572237133417488137) }},
// Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the result are correct, last result was 3.0871891698197084e+73 // Unexpected exception : Error in function boost::math::hypergeometric_pFq<long T> : Cancellation is so severe that no bits in the result are correct, last result was 3.0871891698197084e+73
{ { static_cast<double>(-5.9981750131794866e-15), static_cast<double>(-0.500000000000006), static_cast<double>(-240.42092034220695), SC_(1.00000000000003262784934420226963147689063665) }}, { { static_cast<T>(-5.9981750131794866e-15), static_cast<T>(-0.500000000000006), static_cast<T>(-240.42092034220695), SC_(1.00000000000003262784934420226963147689063665) }},
// Unexpected high error : 18466.4373304979599197395145893096923828125 Found : 1.32865406167486480872551302123696359558380209e-08 Expected : 1.3286540616694168317751162703647255236560909e-08 // Unexpected high error : 18466.4373304979599197395145893096923828125 Found : 1.32865406167486480872551302123696359558380209e-08 Expected : 1.3286540616694168317751162703647255236560909e-08
{ { static_cast<double>(6.772927684190258e-10), static_cast<double>(-0.99999999932270722), static_cast<double>(-483.69576895236969), SC_(1.32865406166941679958876322759721528297325713e-08) }}, { { static_cast<T>(6.772927684190258e-10), static_cast<T>(-0.99999999932270722), static_cast<T>(-483.69576895236969), SC_(1.32865406166941679958876322759721528297325713e-08) }},
// Unexpected high error: 1.79769e+308 Found: -nan(ind) Expected: 5.31173e-38 // Unexpected high error: 1.79769e+308 Found: -nan(ind) Expected: 5.31173e-38
{{ static_cast<double>(6763.4877452850342), static_cast<double>(3.6834977949762315e-08), static_cast<double>(-210.20976513624191), SC_(5.31173132667573457976877380237496445775181141e-38) }}, {{ static_cast<T>(6763.4877452850342), static_cast<T>(3.6834977949762315e-08), static_cast<T>(-210.20976513624191), SC_(5.31173132667573457976877380237496445775181141e-38) }},
// Unexpected high error : 1.79769313486231570814527423731704356798070568e+308 Found : -nan(ind) Expected : 1.04274264437409856500364465136386556989276338e+54 // Unexpected high error : 1.79769313486231570814527423731704356798070568e+308 Found : -nan(ind) Expected : 1.04274264437409856500364465136386556989276338e+54
{ { static_cast<double>(-6763.4877452850342), static_cast<double>(3.6834977949762315e-08), static_cast<double>(210.20976513624191), SC_(1.04274264437409861991447530452939035771734596e+54) }}, { { static_cast<T>(-6763.4877452850342), static_cast<T>(3.6834977949762315e-08), static_cast<T>(210.20976513624191), SC_(1.04274264437409861991447530452939035771734596e+54) }},
// Unexpected high error: 3.17219226436543247206316287281668161679098192e+185 Found: 1.00012411189051491970538746574092795078602734e+201 Expected: 14198882672502154063215954231296 // Unexpected high error: 3.17219226436543247206316287281668161679098192e+185 Found: 1.00012411189051491970538746574092795078602734e+201 Expected: 14198882672502154063215954231296
{{ static_cast<double>(76763.042617797852), static_cast<double>(-21.722407214343548), static_cast<double>(-0.60326536209322512), SC_(14198882672502153010712531896984.8126667697959) }}, {{ static_cast<T>(76763.042617797852), static_cast<T>(-21.722407214343548), static_cast<T>(-0.60326536209322512), SC_(14198882672502153010712531896984.8126667697959) }},
// Unexpected high error: 1.79769313486231570814527423731704356798070568e+308 Found: -2.39521645877904927856730119998375850409649219e+124 Expected: 2.3952164587795095929135248712964248422934629e+124 // Unexpected high error: 1.79769313486231570814527423731704356798070568e+308 Found: -2.39521645877904927856730119998375850409649219e+124 Expected: 2.3952164587795095929135248712964248422934629e+124
{{ static_cast<double>(-1.8857404964801872e-09), static_cast<double>(-226.52341184020042), static_cast<double>(160.86221924424171), SC_(2.39521645877950946848639784331327651190093595e+124) }}, {{ static_cast<T>(-1.8857404964801872e-09), static_cast<T>(-226.52341184020042), static_cast<T>(160.86221924424171), SC_(2.39521645877950946848639784331327651190093595e+124) }},
// Unexpected high error : 73027.246763920571538619697093963623046875 Found : 0.000111810625893715248580992382976262433658121154 Expected : 0.000111810625895528292111404111697225971511215903 // Unexpected high error : 73027.246763920571538619697093963623046875 Found : 0.000111810625893715248580992382976262433658121154 Expected : 0.000111810625895528292111404111697225971511215903
{ { static_cast<double>(-7.5220323642510769e-13), static_cast<double>(-1.0000000000007523), static_cast<double>(-17.948102783411741), SC_(0.00011181062589552829441403260197223627311023229) }}, { { static_cast<T>(-7.5220323642510769e-13), static_cast<T>(-1.0000000000007523), static_cast<T>(-17.948102783411741), SC_(0.00011181062589552829441403260197223627311023229) }},
// Unexpected high error: 111726.15160028330865316092967987060546875 Found: 0.00856985181006919560786627698689699172973632813 Expected: 0.00856985180985659310282098743982714950107038021 // Unexpected high error: 111726.15160028330865316092967987060546875 Found: 0.00856985181006919560786627698689699172973632813 Expected: 0.00856985180985659310282098743982714950107038021
{{ static_cast<double>(5.6136137469239618e-15), static_cast<double>(-0.99999999999999434), static_cast<double>(-1989.8742001056671), SC_(0.00856985180985659334965068576732515544478559175) }}, {{ static_cast<T>(5.6136137469239618e-15), static_cast<T>(-0.99999999999999434), static_cast<T>(-1989.8742001056671), SC_(0.00856985180985659334965068576732515544478559175) }},
// Unexpected high error : 10431.000000023717802832834422588348388671875 Found : 0.99999999999772626324556767940521240234375 Expected : 1.00000000000004241051954068097984418272972107 // Unexpected high error : 10431.000000023717802832834422588348388671875 Found : 0.99999999999772626324556767940521240234375 Expected : 1.00000000000004241051954068097984418272972107
{ { static_cast<double>(-5.6136137469239618e-15), static_cast<double>(-0.50000000000000566), static_cast<double>(-1989.8742001056671), SC_(1.00000000000004243096226509338784935080089269) }}, { { static_cast<T>(-5.6136137469239618e-15), static_cast<T>(-0.50000000000000566), static_cast<T>(-1989.8742001056671), SC_(1.00000000000004243096226509338784935080089269) }},
// And more from error rate testing: // And more from error rate testing:
{{ (T)std::ldexp((double)-17079780487168000, -44), (T)std::ldexp((double)9462273998848000, -46), (T)std::ldexp((double)9928190459904000, -48), SC_(7.7358754011357422722746277257633664799903803239195e-72) }}, {{ (T)std::ldexp((double)-17079780487168000, -44), (T)std::ldexp((double)9462273998848000, -46), (T)std::ldexp((double)9928190459904000, -48), SC_(7.7358754011357422722746277257633664799903803239195e-72) }},
{{ (T)std::ldexp((double)-16238757384192000, -44), (T)std::ldexp((double)17248812490752000, -44), (T)std::ldexp((double)12549255331840000, -49), SC_(4.7354970214088286546733909450191631190700414608975e-10) }}, {{ (T)std::ldexp((double)-16238757384192000, -44), (T)std::ldexp((double)17248812490752000, -44), (T)std::ldexp((double)12549255331840000, -49), SC_(4.7354970214088286546733909450191631190700414608975e-10) }},
{{ static_cast<double>(-6.8543290253728628), static_cast<double>(607.72073245607316), static_cast<double>(253.26409819535911), SC_(0.024418741483258497441042709681531519387974841769189) }}, {{ static_cast<T>(-6.8543290253728628), static_cast<T>(607.72073245607316), static_cast<T>(253.26409819535911), SC_(0.024418741483258497441042709681531519387974841769189) }},
{{ (T)std::ldexp((double)-15569844699136000, -52), (T)std::ldexp((double)12855440629760000, -44), (T)std::ldexp((double)12563412279296000, -45), SC_(0.097879401070280078654536987721507669872679020399179) }}, {{ (T)std::ldexp((double)-15569844699136000, -52), (T)std::ldexp((double)12855440629760000, -44), (T)std::ldexp((double)12563412279296000, -45), SC_(0.097879401070280078654536987721507669872679020399179) }},
{{ (T)std::ldexp((double)-13521484578816000, -48), (T)std::ldexp((double)11813014388736000, -46), (T)std::ldexp((double)12736881098752000, -48), SC_(9.1262751214688536871555425535678062558805718157237e-08) }}, {{ (T)std::ldexp((double)-13521484578816000, -48), (T)std::ldexp((double)11813014388736000, -46), (T)std::ldexp((double)12736881098752000, -48), SC_(9.1262751214688536871555425535678062558805718157237e-08) }},
{{ (T)std::ldexp((double)-13125670141952000, -44), (T)std::ldexp((double)16524914262016000, -44), (T)std::ldexp((double)12270166867968000, -49), SC_(2.0809215788388623809065210261671764534436583442155e-08) }}, {{ (T)std::ldexp((double)-13125670141952000, -44), (T)std::ldexp((double)16524914262016000, -44), (T)std::ldexp((double)12270166867968000, -49), SC_(2.0809215788388623809065210261671764534436583442155e-08) }},
@@ -295,36 +295,36 @@ void test_spots6(T, const char* type_name)
// //
// Special cases for a,b equal and negative integers, see: // Special cases for a,b equal and negative integers, see:
// //
{ {-1, -1, 0.9999999999990905052982270717620850, SC_(1.9999999999990905052982270717620850)} }, { {-1, -1, SC_(0.9999999999990905052982270717620850), SC_(1.9999999999990905052982270717620850)} },
{ { -2, -2, 0.9999999999990905052982270717620850, SC_(2.4999999999981810105964545571144762) } }, { { -2, -2, SC_(0.9999999999990905052982270717620850), SC_(2.4999999999981810105964545571144762) } },
{ { -3, -3, 0.9999999999990905052982270717620850, SC_(2.6666666666643929299122351732524916) } }, { { -3, -3, SC_(0.9999999999990905052982270717620850), SC_(2.6666666666643929299122351732524916) } },
{ { -4, -4, 0.9999999999990905052982270717620850, SC_(2.7083333333309080141286065586746589) } }, { { -4, -4, SC_(0.9999999999990905052982270717620850), SC_(2.7083333333309080141286065586746589) } },
{ { -5, -5, 0.9999999999990905052982270717620850, SC_(2.7166666666642034518493660889297968) } }, { { -5, -5, SC_(0.9999999999990905052982270717620850), SC_(2.7166666666642034518493660889297968) } },
{ { -6, -6, 0.9999999999990905052982270717620850, SC_(2.7180555555530847616157402206496325) } }, { { -6, -6, SC_(0.9999999999990905052982270717620850), SC_(2.7180555555530847616157402206496325) } },
{ { -7, -7, 0.9999999999990905052982270717620850, SC_(2.7182539682514961968413528410609673) } }, { { -7, -7, SC_(0.9999999999990905052982270717620850), SC_(2.7182539682514961968413528410609673) } },
{ { -8, -8, 0.9999999999990905052982270717620850, SC_(2.7182787698387976036876421724036051) } }, { { -8, -8, SC_(0.9999999999990905052982270717620850), SC_(2.7182787698387976036876421724036051) } },
{ { -9, -9, 0.9999999999990905052982270717620850, SC_(2.7182815255707199797197951818652022) } }, { { -9, -9, SC_(0.9999999999990905052982270717620850), SC_(2.7182815255707199797197951818652022) } },
{ { -10, -10, 0.9999999999990905052982270717620850, SC_(2.7182818011439122170723781245206092) } }, { { -10, -10, SC_(0.9999999999990905052982270717620850), SC_(2.7182818011439122170723781245206092) } },
{ { -11, -11, 0.9999999999990905052982270717620850, SC_(2.7182818261960206022634645412810530) } }, { { -11, -11, SC_(0.9999999999990905052982270717620850), SC_(2.7182818261960206022634645412810530) } },
{ { -12, -12, 0.9999999999990905052982270717620850, SC_(2.7182818282836963010274896793573756) } }, { { -12, -12, SC_(0.9999999999990905052982270717620850), SC_(2.7182818282836963010274896793573756) } },
{ { -13, -13, 0.9999999999990905052982270717620850, SC_(2.7182818284442867393938070953642430) } }, { { -13, -13, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284442867393938070953642430) } },
{ { -14, -14, 0.9999999999990905052982270717620850, SC_(2.7182818284557574849913907639252443) } }, { { -14, -14, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284557574849913907639252443) } },
{ { -15, -15, 0.9999999999990905052982270717620850, SC_(2.7182818284565222013645623129904880) } }, { { -15, -15, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565222013645623129904880) } },
{ { -16, -16, 0.9999999999990905052982270717620850, SC_(2.7182818284565699961378854913379726) } }, { { -16, -16, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565699961378854913379726) } },
{ { -17, -17, 0.9999999999990905052982270717620850, SC_(2.7182818284565728075951397933896427)} }, { { -17, -17, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565728075951397933896427)} },
{ { -18, -18, 0.9999999999990905052982270717620850, SC_(2.7182818284565729637872094766949018) } }, { { -18, -18, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565729637872094766949018) } },
{ { -19, -19, 0.9999999999990905052982270717620850, SC_(2.7182818284565729720078447231771757) } }, { { -19, -19, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565729720078447231771757) } },
{ { -20, -20, 0.9999999999990905052982270717620850, SC_(2.7182818284565729724188764855009155) } }, { { -20, -20, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565729724188764855009155) } },
{ { -21, -21, 0.9999999999990905052982270717620850, SC_(2.7182818284565729724384494265639330) } }, { { -21, -21, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565729724384494265639330) } },
{ { -22, -22, 0.9999999999990905052982270717620850, SC_(2.7182818284565729724393391057031602) } }, { { -22, -22, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565729724393391057031602) } },
{ { -23, -23, 0.9999999999990905052982270717620850, SC_(2.7182818284565729724393777874048657) } }, { { -23, -23, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565729724393777874048657) } },
{ { -24, -24, 0.9999999999990905052982270717620850, SC_(2.7182818284565729724393793991424368) } }, { { -24, -24, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565729724393793991424368) } },
{ { -25, -25, 0.9999999999990905052982270717620850, SC_(2.7182818284565729724393794636119396) } }, { { -25, -25, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565729724393794636119396) } },
{ { -26, -26, 0.9999999999990905052982270717620850, SC_(2.7182818284565729724393794660915359) } }, { { -26, -26, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565729724393794660915359) } },
{ { -27, -27, 0.9999999999990905052982270717620850, SC_(2.7182818284565729724393794661833728) } }, { { -27, -27, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565729724393794661833728) } },
{ { -28, -28, 0.9999999999990905052982270717620850, SC_(2.7182818284565729724393794661866527) } }, { { -28, -28, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565729724393794661866527) } },
{ { -29, -29, 0.9999999999990905052982270717620850, SC_(2.7182818284565729724393794661867658) } }, { { -29, -29, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565729724393794661867658) } },
{ { -30, -30, 0.9999999999990905052982270717620850, SC_(2.7182818284565729724393794661867696) } }, { { -30, -30, SC_(0.9999999999990905052982270717620850), SC_(2.7182818284565729724393794661867696) } },
{ {-1, -1, 23.5, 24.500000000000000000000000000000000} }, { {-1, -1, 23.5, 24.500000000000000000000000000000000} },
{ { -2, -2, 23.5, SC_(300.62500000000000000000000000000000) } }, { { -2, -2, 23.5, SC_(300.62500000000000000000000000000000) } },
@@ -395,14 +395,18 @@ void test_spots6(T, const char* type_name)
{{ 13, 1.5f, 61, SC_(1.35508577094765660270265300640877455638098585524020525369044e39)}}, {{ 13, 1.5f, 61, SC_(1.35508577094765660270265300640877455638098585524020525369044e39)}},
{{ 13, 1.5f - T(1)/128, 61, SC_(1.40067238333701986992154961431485209677766220602448290643906e39)}}, {{ 13, 1.5f - T(1)/128, 61, SC_(1.40067238333701986992154961431485209677766220602448290643906e39)}},
{{ 13, 1.5f + T(1)/128, 61, SC_(1.31105748771677778012064837998217769289913724450105998963999e39)}}, {{ 13, 1.5f + T(1)/128, 61, SC_(1.31105748771677778012064837998217769289913724450105998963999e39)}},
// Uncovered code:
{ { SC_(3.125), SC_(-4.25), SC_(0.25), SC_(0.8377654489787288706170314748630804839990046835429477943509538691)}},
{ { SC_(3.125), SC_(-4.25), SC_(6.25), SC_(-1.0732328736644883882525050418994056179896661423277961620744e8)}},
} }; } };
static const std::array<std::array<T, 4>, 2> hypergeometric_1F1_big_bugs = { { static const std::array<std::array<T, 4>, 2> hypergeometric_1F1_big_bugs = { {
#if DBL_MAX_EXP == LDBL_MAX_EXP #if DBL_MAX_EXP == LDBL_MAX_EXP
{{ static_cast<double>(7.8238229420435346e-05), static_cast<double>(-5485.3222503662109), static_cast<double>(1896.0561106204987), BOOST_MATH_HUGE_CONSTANT(T, 1000, 4.33129800901478785957996719992774682013355926e+668) }}, {{ static_cast<T>(7.8238229420435346e-05), static_cast<T>(-5485.3222503662109), static_cast<T>(1896.0561106204987), BOOST_MATH_HUGE_CONSTANT(T, 1000, 4.33129800901478785957996719992774682013355926e+668) }},
{{ static_cast<double>(-7.8238229420435346e-05), static_cast<double>(-5485.3222503662109), static_cast<double>(1896.0561106204987), BOOST_MATH_HUGE_CONSTANT(T, 1000, -4.3248750673398590673783317624407455467680038e+668) }}, {{ static_cast<T>(-7.8238229420435346e-05), static_cast<T>(-5485.3222503662109), static_cast<T>(1896.0561106204987), BOOST_MATH_HUGE_CONSTANT(T, 1000, -4.3248750673398590673783317624407455467680038e+668) }},
#else #else
{ { static_cast<double>(7.8238229420435346e-05), static_cast<double>(-5485.3222503662109), static_cast<double>(1896.0561106204987), SC_(4.33129800901478785957996719992774682013355926e+668) } }, { { static_cast<T>(7.8238229420435346e-05), static_cast<T>(-5485.3222503662109), static_cast<T>(1896.0561106204987), SC_(4.33129800901478785957996719992774682013355926e+668) } },
{ { static_cast<double>(-7.8238229420435346e-05), static_cast<double>(-5485.3222503662109), static_cast<double>(1896.0561106204987), SC_(-4.3248750673398590673783317624407455467680038e+668) } }, { { static_cast<T>(-7.8238229420435346e-05), static_cast<T>(-5485.3222503662109), static_cast<T>(1896.0561106204987), SC_(-4.3248750673398590673783317624407455467680038e+668) } },
#endif #endif
} }; } };
do_test_1F1<T>(hypergeometric_1F1_bugs, type_name, "Bug cases"); do_test_1F1<T>(hypergeometric_1F1_bugs, type_name, "Bug cases");
@@ -426,6 +430,15 @@ void test_spots7(T, const char* type_name)
do_test_1F1<T>(hypergeometric_1f1_neg_int, type_name, "Both parameters negative integers."); do_test_1F1<T>(hypergeometric_1f1_neg_int, type_name, "Both parameters negative integers.");
} }
template <class T>
void test_spots8(T, const char* type_name)
{
BOOST_CHECK_THROW(boost::math::hypergeometric_1F1(static_cast<T>(2), static_cast<T>(-100), static_cast<T>(0.5)), std::domain_error);
BOOST_CHECK_THROW(boost::math::hypergeometric_1F1(static_cast<T>(-100.1), static_cast<T>(-100), static_cast<T>(0.5)), std::domain_error);
BOOST_CHECK_THROW(boost::math::hypergeometric_1F1(static_cast<T>(-102), static_cast<T>(-100), static_cast<T>(0.5)), std::domain_error);
BOOST_CHECK_THROW(boost::math::hypergeometric_1F1(static_cast<T>(-50.25), static_cast<T>(-100), static_cast<T>(0.5)), std::domain_error);
}
template <class T> template <class T>
void test_spots(T z, const char* type_name) void test_spots(T z, const char* type_name)
{ {
@@ -448,6 +461,7 @@ void test_spots(T z, const char* type_name)
if(std::numeric_limits<T>::digits >= std::numeric_limits<double>::digits && std::numeric_limits<T>::digits <= 128) if(std::numeric_limits<T>::digits >= std::numeric_limits<double>::digits && std::numeric_limits<T>::digits <= 128)
test_spots6(z, type_name); test_spots6(z, type_name);
test_spots7(z, type_name); test_spots7(z, type_name);
test_spots8(z, type_name);
} }

View File

@@ -77,6 +77,19 @@ void test_spots2(T, const char* type_name)
do_test_1F1<T>(hypergeometric_1f1_log_large_unsolved, type_name, "Large random values - log - unsolved"); do_test_1F1<T>(hypergeometric_1f1_log_large_unsolved, type_name, "Large random values - log - unsolved");
} }
template <class T>
void test_sign(T, const char* type_name)
{
#include "hypergeometric_1F1_small_random.ipp"
for (unsigned i = 0; i < hypergeometric_1F1_small_random.size(); ++i)
{
int s;
boost::math::log_hypergeometric_1F1(hypergeometric_1F1_small_random[i][0], hypergeometric_1F1_small_random[i][1], hypergeometric_1F1_small_random[i][2], &s);
BOOST_CHECK_EQUAL(s, boost::math::sign(hypergeometric_1F1_small_random[i][3]));
}
}
template <class T> template <class T>
void test_spots_bugs(T, const char* type_name) void test_spots_bugs(T, const char* type_name)
{ {
@@ -99,6 +112,7 @@ void test_spots(T z, const char* type_name)
{ {
test_spots1(z, type_name); test_spots1(z, type_name);
test_spots_bugs(z, type_name); test_spots_bugs(z, type_name);
test_sign(z, type_name);
#ifdef TEST_UNSOLVED #ifdef TEST_UNSOLVED
test_spots2(z, type_name); test_spots2(z, type_name);
#endif #endif

View File

@@ -162,11 +162,6 @@ BOOST_AUTO_TEST_CASE( test_main )
expected_results(); expected_results();
BOOST_MATH_CONTROL_FP; BOOST_MATH_CONTROL_FP;
#if !defined(TEST) || (TEST == 1)
test_hypergeometric_mellin_transform<double>();
test_hypergeometric_laplace_transform<double>();
#endif
#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
#if !defined(TEST) || (TEST == 2) #if !defined(TEST) || (TEST == 2)
test_spots(0.0F, "float"); test_spots(0.0F, "float");

View File

@@ -77,5 +77,21 @@ template <class T>
void test_spots(T z, const char* type_name) void test_spots(T z, const char* type_name)
{ {
test_spots1(z, type_name); test_spots1(z, type_name);
//
// Special cases for coverage:
//
BOOST_IF_CONSTEXPR(std::numeric_limits<T>::has_infinity)
{
BOOST_CHECK_EQUAL(boost::math::hypergeometric_1F1_regularized(600.25, 102.75, 11512.0), std::numeric_limits<T>::infinity());
BOOST_IF_CONSTEXPR(std::numeric_limits<T>::max_exponent == 16384)
{
BOOST_CHECK_EQUAL(boost::math::hypergeometric_1F1_regularized(600.25, 102.75, 9985.0), std::numeric_limits<T>::infinity());
}
else BOOST_IF_CONSTEXPR(std::numeric_limits<T>::max_exponent <= std::numeric_limits<double>::max_exponent)
{
BOOST_CHECK_EQUAL(boost::math::hypergeometric_1F1_regularized(600.25, 102.75, 514.0), std::numeric_limits<T>::infinity());
}
}
} }

View File

@@ -99,4 +99,9 @@ void test_spots(T z, const char* type_name)
a1 = -0.5f; a1 = -0.5f;
BOOST_CHECK((boost::math::isinf)(boost::math::hypergeometric_2F0(a1, a2, z))); BOOST_CHECK((boost::math::isinf)(boost::math::hypergeometric_2F0(a1, a2, z)));
} }
//
// Coverage:
//
BOOST_CHECK_EQUAL(boost::math::hypergeometric_2F0(T(0), T(20), T(2)), T(1));
BOOST_CHECK_EQUAL(boost::math::hypergeometric_2F0(T(20), T(0), T(2)), T(1));
} }