← 返回首页
1F1: Update tests for previous changes, improve error testing code. · boostorg/math@52e4ee3 · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Commit 52e4ee3

Browse files
committed
1F1: Update tests for previous changes, improve error testing code.
1 parent f520bc9 commit 52e4ee3

3 files changed

Lines changed: 35 additions & 13 deletions

File tree

‎test/test_1F1.hpp‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void test_spots5(T, const char* type_name)
160160
template <class T>
161161
void test_spots6(T, const char* type_name)
162162
{
163-
static const boost::array<boost::array<T, 4>, 75> hypergeometric_1F1_bugs = { {
163+
static const boost::array<boost::array<T, 4>, 91> hypergeometric_1F1_bugs = { {
164164
{ { static_cast<double>(17955.561660766602), static_cast<double>(9.6968994205831605e-09), static_cast<double>(-82.406154185533524), SC_(6.98056008378736714088730927132364938220428678e-11) }},
165165
{ { static_cast<double>(17955.561660766602), static_cast<double>(-9.6968994205831605e-09), static_cast<double>(-82.406154185533524), SC_(-6.98055306629610746072607353939306734740549551e-11) }},
166166
{ { static_cast<double>(-17955.561660766602), static_cast<double>(-9.6968994205831605e-09), static_cast<double>(82.406154185533524), SC_(-42897094853118832762870100.8669248353530950866) }} ,
@@ -267,6 +267,24 @@ void test_spots6(T, const char* type_name)
267267
{ { std::ldexp((double)10485122560373760, -40), std::ldexp((double)-11098279821997376, -39), std::ldexp((double)16925852270592000, -45), SC_(9.77378642649349178995585980824930703376759021e-98) } },
268268
{ { std::ldexp((double)10485292967829248, -40), std::ldexp((double)-14859721380002656, -35), std::ldexp((double)13729956970496000, -44), SC_(3.41094899910311302761937103011397882987669395e-08) } },
269269
{ { std::ldexp((double)10485037389193216, -40), std::ldexp((double)-10840488483391544, -35), std::ldexp((double)17577061875712000, -45), SC_(2.8030884395368690164859926372380406504460219e-07) } },
270+
//
271+
// Negative a and b worst cases:
272+
{ { std::ldexp((double)-9281686323200000, -44), std::ldexp((double)-14062138056704000, -44), std::ldexp((double)13563284652032000, -44), SC_(2.83381029611748905436564183928049453625733389e+265) } },
273+
{ { std::ldexp((double)-17049048150016000, -44), std::ldexp((double)-16971363917824000, -45), std::ldexp((double)11759598960640000, -49), SC_(4636596575297708282.15391199523219256661832333) }},
274+
{ { std::ldexp((double)-14233964060672000, -45), std::ldexp((double)-12648356216832000, -47), std::ldexp((double)9597206757376000, -46), SC_(-1.29952965544474451915331906705211320124261355e+104) }},
275+
{ { std::ldexp((double)-16705334214656000, -45), std::ldexp((double)-15447756718080000, -46), std::ldexp((double)16395884134400000, -47), SC_(5.40680141346616359293013198457674276017117348e+113) }},
276+
{ { std::ldexp((double)-13991530405888000, -45), std::ldexp((double)-10196587347968000, -46), std::ldexp((double)13331347734528000, -46), SC_(1.28612752976615347819085089716937824474111365e+138) }},
277+
{ { std::ldexp((double)-15134950760448000, -45), std::ldexp((double)-14587193786368000, -48), std::ldexp((double)17022855921664000, -46), SC_(-8.81689040877580073465185463207591010592963947e+115) }},
278+
{ { std::ldexp((double)-14854672039936000, -45), std::ldexp((double)-10436558200832000, -45), std::ldexp((double)11370918969344000, -47), SC_(8.85535247272534117445528460568920680343270651e+54) } },
279+
{ { std::ldexp((double)-16711069286400000, -46), std::ldexp((double)-14809815056384000, -46), std::ldexp((double)10469312954368000, -47), SC_(50343352353398198766339890377962553344.0) } },
280+
{ { std::ldexp((double)-15026786402304000, -45), std::ldexp((double)-16687356968960000, -46), std::ldexp((double)14895621603328000, -47), SC_(2.85329560424602656900599696665580727040444839e+95) } },
281+
{ { std::ldexp((double)-15519073435648000, -45), std::ldexp((double)-14162009718784000, -45), std::ldexp((double)9997818855424000, -48), SC_(95767987018108517.7639995774279100260173436254) } },
282+
{ { std::ldexp((double)-15317481275392000, -46), std::ldexp((double)-16531865931776000, -44), std::ldexp((double)17586268880896000, -45), SC_(1.47012480470837240834700634331053708005164679e+104) }},
283+
{ { std::ldexp((double)-11335669673984000, -44), std::ldexp((double)-13146047094784000, -44), std::ldexp((double)13671437864960000, -44), SC_(-2.18876072849870893180776779453843962111085257e+288) }},
284+
{ { std::ldexp((double)-16877985234944000, -46), std::ldexp((double)-14384006086656000, -46), std::ldexp((double)9074349342720000, -47), SC_(15376193613462463541358751744655360.0) }},
285+
{ { std::ldexp((double)-9751199809536000, -45), std::ldexp((double)-17654191685632000, -47), std::ldexp((double)10587451850752000, -47), SC_(-1.9601415510439595625538337964298353914980331e+68) }},
286+
{ { std::ldexp((double)-15233620754432000, -45), std::ldexp((double)-12708283072512000, -46), std::ldexp((double)10255461007360000, -46), SC_(-5.43441063616790758618595678580168066778261756e+125) }},
287+
{ { std::ldexp((double)-11241354149888000, -45), std::ldexp((double)-9580579905536000, -45), std::ldexp((double)12224976846848000, -47), SC_(1.20468565484700674058707264904280026536015299e+46) }},
270288
} };
271289
static const boost::array<boost::array<T, 4>, 2> hypergeometric_1F1_big_bugs = { {
272290
#if DBL_MAX_EXP == LDBL_MAX_EXP

‎tools/hypergeometric_1F1_error_plot.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ int main()
122122
mpfr_float mp_expected;
123123

124124
try {
125-
mp_expected = boost::math::hypergeometric_pFq_precision({ mpfr_float(a) }, { mpfr_float(b) }, mpfr_float(z), 25, 3.0);
125+
mp_expected = boost::math::hypergeometric_pFq_precision({ mpfr_float(a) }, { mpfr_float(b) }, mpfr_float(z), 25, 200.0);
126126
expected = (test_type)mp_expected;
127127
}
128128
catch (const std::exception&)

‎tools/hypergeometric_1F1_map_neg_b_fwd_recurrence.cpp‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ int main()
5656
std::cin >> b_mult;
5757

5858
double error_limit = 200;
59-
double time_limit = 100.0;
59+
double time_limit = 10.0;
6060

6161
for (test_type a = a_start; a < a_end; a_start < 0 ? a /= a_mult : a *= a_mult)
6262
{
@@ -65,9 +65,10 @@ int main()
6565
test_type z_mult = 2;
6666
test_type last_good = 0;
6767
test_type bad = 0;
68-
for (test_type z = 1; z < 1e10; z *= z_mult, z_mult *= 2)
69-
{
70-
try {
68+
try {
69+
for (test_type z = 1; z < 1e10; z *= z_mult, z_mult *= 2)
70+
{
71+
// std::cout << "z = " << z << std::endl;
7172
boost::uintmax_t max_iter = 1000;
7273
test_type calc = boost::math::tools::function_ratio_from_forwards_recurrence(boost::math::detail::hypergeometric_1F1_recurrence_a_and_b_coefficients<test_type>(a, b, z), std::numeric_limits<test_type>::epsilon() * 2, max_iter);
7374
test_type reference = (test_type)(boost::math::hypergeometric_pFq_precision({ mpfr_float(a) }, { mpfr_float(b) }, mpfr_float(z), 50, time_limit) / boost::math::hypergeometric_pFq_precision({ mpfr_float(a + 1) }, { mpfr_float(b + 1) }, mpfr_float(z), std::numeric_limits<test_type>::digits10 * 2, time_limit));
@@ -83,11 +84,11 @@ int main()
8384
bad = z;
8485
}
8586
}
86-
catch (const std::exception& e)
87-
{
88-
std::cout << "Unexpected exception: " << e.what() << std::endl;
89-
std::cout << "For a = " << a << " b = " << b << " z = " << z << std::endl;
90-
}
87+
}
88+
catch (const std::exception& e)
89+
{
90+
std::cout << "Unexpected exception: " << e.what() << std::endl;
91+
std::cout << "For a = " << a << " b = " << b << " z = " << bad * z_mult / 2 << std::endl;
9192
}
9293
test_type z_limit;
9394
if (0 == bad)
@@ -109,14 +110,16 @@ int main()
109110
}, bad, last_good, boost::math::tools::equal_floor()).first;
110111
z_limit = floor(z_limit + 2); // Give ourselves some headroom!
111112
}
113+
// std::cout << "z_limit = " << z_limit << std::endl;
112114
//
113115
// Now over again for backwards recurrence domain at the same points:
114116
//
115-
bad = z_limit;
117+
bad = z_limit > 1e10 ? 1e10 : z_limit;
116118
last_good = 0;
117119
z_mult = 1.1;
118-
for (test_type z = z_limit; z > 1; z /= z_mult, z_mult *= 2)
120+
for (test_type z = bad; z > 1; z /= z_mult, z_mult *= 2)
119121
{
122+
// std::cout << "z = " << z << std::endl;
120123
try {
121124
boost::uintmax_t max_iter = 1000;
122125
test_type calc = boost::math::tools::function_ratio_from_backwards_recurrence(boost::math::detail::hypergeometric_1F1_recurrence_a_and_b_coefficients<test_type>(a, b, z), std::numeric_limits<test_type>::epsilon() * 2, max_iter);
@@ -135,6 +138,7 @@ int main()
135138
}
136139
catch (const std::exception& e)
137140
{
141+
bad = z;
138142
std::cout << "Unexpected exception: " << e.what() << std::endl;
139143
std::cout << "For a = " << a << " b = " << b << " z = " << z << std::endl;
140144
}

0 commit comments

Comments
 (0)

Footer

© 2026 GitHub, Inc.