Skip to content

Improve Coverage Part 4 #1262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 47 commits into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
50def60
Coverage: enable accidentality disabled 2F0 tests.
jzmaddock Apr 28, 2025
1fc0741
Coverage: Jacobi Elliptic, test error handling, simplify code.
jzmaddock Apr 28, 2025
aaf7c20
Coverage: jacobi_theta.hpp, cosmetic changes plus tests.
jzmaddock Apr 28, 2025
bd8b61a
Coverage: Laguerre polynomials test case.
jzmaddock Apr 28, 2025
64e1461
Coverage: more Jacobi theta test cases.
jzmaddock Apr 29, 2025
a7bb5f5
Coverage: Add more tests for LambertW.
jzmaddock Apr 29, 2025
ca4d891
Coverage: Improve Lambert_w error handling and fix up test cases.
jzmaddock Apr 29, 2025
895a4de
Coverage: Remove unneeded #includes from lambert_w.hpp.
jzmaddock Apr 29, 2025
82cbead
Coverage: remove testing of lambert_wm1 with integer args.
jzmaddock Apr 30, 2025
e0f1785
Coverage: lambert_w.hpp, remove dead code, turn dead code to asserts.
jzmaddock Apr 30, 2025
dfab2ad
Coverage: extra lambert_w test cases.
jzmaddock Apr 30, 2025
e494410
Coverage: Make sure lambert_w_derivative tests are actually run!
jzmaddock Apr 30, 2025
490af2e
Unreachable line in fpclassify.hpp
jzmaddock Apr 30, 2025
5daedec
Coverage: many tests were not being run due to (accidental) dependency.
jzmaddock May 1, 2025
e742396
Coverage: mark up lambert_w tables.
jzmaddock May 2, 2025
dbd2028
Coverage: Add better Lanczos testing.
jzmaddock May 2, 2025
a6688c9
Coverage: trivial lambert_w markup.
jzmaddock May 2, 2025
cf79a90
Coverage: Mark up expint tables.
jzmaddock May 3, 2025
95e0c1f
Coverage: another Lanczos test case.
jzmaddock May 3, 2025
399139c
Coverage: Remove dead code from legendre.hpp and add more test cases.
jzmaddock May 4, 2025
6280934
Coverage: legendre_stieltjes test case.
jzmaddock May 4, 2025
7556310
Coverage: Cosmetic changes to log1p plus more tests.
jzmaddock May 4, 2025
c0a97ed
Coverage: legendre.hpp trivial markup.
jzmaddock May 5, 2025
aa1f997
Coverage: logaddexp test case.
jzmaddock May 5, 2025
1ec15dd
Coverage: Improve next.hpp.
jzmaddock May 6, 2025
01e1a62
Coverage: Fix Jamfile.
jzmaddock May 7, 2025
295c5a3
Coverage: last few lines of next.hpp.
jzmaddock May 7, 2025
404fccd
Coverage: Fix up nonfinite_num_facets.hpp
jzmaddock May 7, 2025
b485b22
Coverage: Fix test_next.cpp.
jzmaddock May 8, 2025
d534180
Coverage: Mark up default & break statements which don't seem to cove…
jzmaddock May 8, 2025
a7f298c
Coverage: powm1 tests.
jzmaddock May 8, 2025
ef4cdb9
Coverage: Add coverage for prime.hpp.
jzmaddock May 8, 2025
022dbe9
Coverage: Improve sinc_pi complex tests.
jzmaddock May 8, 2025
9a1c19d
Coverage: spherical_harmonic tests.
jzmaddock May 8, 2025
ea0cd6a
Coverage: try and fix up sinc_pi test.
jzmaddock May 9, 2025
4fdbd9a
Coverage: weaken exception specification in test_nonfinite_io.cpp.
jzmaddock May 10, 2025
a8948c3
Coverage: cosmetic change to prime.hpp for coverage detection.
jzmaddock May 10, 2025
034d097
Coverage: improve sinhc_pi tests.
jzmaddock May 10, 2025
384cd81
Coverage: improve trigamma.
jzmaddock May 10, 2025
c159459
Coverage: Add trivial tests for ulp.hpp.
jzmaddock May 11, 2025
d760c31
Coverage: improve zeta.hpp coverage and tests.
jzmaddock May 12, 2025
d110143
Coverage: zeta and ulp tweaks for full coverage.
jzmaddock May 12, 2025
b20cbfa
Allow test_log1p_simple.cpp to be run with no exceptions.
jzmaddock May 14, 2025
3b49983
Coverage: mark up spurious missed line.
jzmaddock May 14, 2025
c851fe9
Coverage: change uncovered lines in owens_t to asserts.
jzmaddock May 14, 2025
60ef55d
Coverage: Fix GPU support.
jzmaddock May 15, 2025
ef849f3
Coverage: correct min/max usage for CUDA.
jzmaddock May 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/boost/math/special_functions/airy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ BOOST_MATH_GPU_ENABLED T airy_ai_zero_imp(int m, const Policy& pol)
// of decimal digits in the numeric type T, being at least 12.
const int my_digits10 = static_cast<int>(static_cast<float>(policies::digits<T, Policy>() * 0.301F));

const std::uintmax_t iterations_allowed = static_cast<std::uintmax_t>((std::max)(12, my_digits10 * 2));
const std::uintmax_t iterations_allowed = static_cast<std::uintmax_t>(BOOST_MATH_GPU_SAFE_MAX(12, my_digits10 * 2));

std::uintmax_t iterations_used = iterations_allowed;

Expand Down Expand Up @@ -239,7 +239,7 @@ BOOST_MATH_GPU_ENABLED T airy_bi_zero_imp(int m, const Policy& pol)
// of decimal digits in the numeric type T, being at least 12.
const int my_digits10 = static_cast<int>(static_cast<float>(policies::digits<T, Policy>() * 0.301F));

const std::uintmax_t iterations_allowed = static_cast<std::uintmax_t>((std::max)(12, my_digits10 * 2));
const std::uintmax_t iterations_allowed = static_cast<std::uintmax_t>(BOOST_MATH_GPU_SAFE_MAX(12, my_digits10 * 2));

std::uintmax_t iterations_used = iterations_allowed;

Expand Down
6 changes: 3 additions & 3 deletions include/boost/math/special_functions/beta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ BOOST_MATH_GPU_ENABLED T binomial_ccdf(T n, T k, T x, T y, const Policy& pol)
}

template <class T, class Policy>
T ibeta_large_ab(T a, T b, T x, T y, bool invert, bool normalised, const Policy& pol)
BOOST_MATH_GPU_ENABLED T ibeta_large_ab(T a, T b, T x, T y, bool invert, bool normalised, const Policy& pol)
{
//
// Large arguments, symetric case, see https://dlmf.nist.gov/8.18
Expand Down Expand Up @@ -1571,11 +1571,11 @@ BOOST_MATH_GPU_ENABLED T ibeta_imp(T a, T b, T x, const Policy& pol, bool inv, b
{
// a and b both large:
bool use_asym = false;
T ma = (std::max)(a, b);
T ma = BOOST_MATH_GPU_SAFE_MAX(a, b);
T xa = ma == a ? x : y;
T saddle = ma / (a + b);
T powers = 0;
if ((ma > 1e-5f / tools::epsilon<T>()) && (ma / (std::min)(a, b) < (xa < saddle ? 2 : 15)))
if ((ma > 1e-5f / tools::epsilon<T>()) && (ma / BOOST_MATH_GPU_SAFE_MIN(a, b) < (xa < saddle ? 2 : 15)))
{
if (a == b)
use_asym = true;
Expand Down
8 changes: 4 additions & 4 deletions include/boost/math/special_functions/detail/ibeta_inverse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,16 +683,16 @@ BOOST_MATH_GPU_ENABLED T ibeta_inv_imp(T a, T b, T p, T q, const Policy& pol, T*
}
else
y = 1;
if((y > 1e-5) && (std::min)(a, b) < 1000)
if((y > 1e-5) && BOOST_MATH_GPU_SAFE_MIN(a, b) < 1000)
{
x = temme_method_3_ibeta_inverse(a, b, p, q, pol);
y = 1 - x;
}
else if ((y > 1e-5) && (std::min)(a, b) > 1000)
else if ((y > 1e-5) && BOOST_MATH_GPU_SAFE_MIN(a, b) > 1000)
{
// All options have failed, use the saddle point as a starting location:
x = (std::max)(a, b) / (a + b);
y = (std::min)(a, b) / (a + b);
x = BOOST_MATH_GPU_SAFE_MAX(a, b) / (a + b);
y = BOOST_MATH_GPU_SAFE_MIN(a, b) / (a + b);
}
}
}
Expand Down
13 changes: 10 additions & 3 deletions include/boost/math/special_functions/expint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ BOOST_MATH_GPU_ENABLED T expint_i_imp(T z, const Policy& pol, const boost::math:
// Maximum Deviation Found: 2.852e-18
// Expected Error Term: 2.852e-18
// Max Error found at double precision = Poly: 2.636335e-16 Cheb: 4.187027e-16
// LCOV_EXCL_START
BOOST_MATH_STATIC const T P[10] = {
BOOST_MATH_BIG_CONSTANT(T, 53, 2.98677224343598593013),
BOOST_MATH_BIG_CONSTANT(T, 53, 0.356343618769377415068),
Expand Down Expand Up @@ -590,6 +591,7 @@ BOOST_MATH_GPU_ENABLED T expint_i_imp(T z, const Policy& pol, const boost::math:
BOOST_MATH_STATIC_LOCAL_VARIABLE const T r1 = static_cast<T>(c1 / c2);
BOOST_MATH_STATIC_LOCAL_VARIABLE const T r2 = BOOST_MATH_BIG_CONSTANT(T, 53, 0.131401834143860282009280387409357165515556574352422001206362e-16);
BOOST_MATH_STATIC_LOCAL_VARIABLE const T r = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 53, 0.372507410781366634461991866580119133535689497771654051555657435242200120636201854384926049951548942392));
// LCOV_EXCL_STOP
T t = (z / 3) - 1;
result = tools::evaluate_polynomial(P, t)
/ tools::evaluate_polynomial(Q, t);
Expand All @@ -609,6 +611,7 @@ BOOST_MATH_GPU_ENABLED T expint_i_imp(T z, const Policy& pol, const boost::math:
// Maximum Deviation Found: 6.546e-17
// Expected Error Term: 6.546e-17
// Max Error found at double precision = Poly: 6.890169e-17 Cheb: 6.772128e-17
// LCOV_EXCL_START
BOOST_MATH_STATIC_LOCAL_VARIABLE const T Y = 1.158985137939453125F;
BOOST_MATH_STATIC const T P[8] = {
BOOST_MATH_BIG_CONSTANT(T, 53, 0.00139324086199402804173),
Expand All @@ -630,6 +633,7 @@ BOOST_MATH_GPU_ENABLED T expint_i_imp(T z, const Policy& pol, const boost::math:
BOOST_MATH_BIG_CONSTANT(T, 53, 0.000402453408512476836472),
BOOST_MATH_BIG_CONSTANT(T, 53, 0.263649630720255691787e-4)
};
// LCOV_EXCL_STOP
T t = z / 2 - 4;
result = Y + tools::evaluate_polynomial(P, t)
/ tools::evaluate_polynomial(Q, t);
Expand All @@ -641,7 +645,7 @@ BOOST_MATH_GPU_ENABLED T expint_i_imp(T z, const Policy& pol, const boost::math:
// Maximum Deviation Found: 1.843e-17
// Expected Error Term: -1.842e-17
// Max Error found at double precision = Poly: 4.375868e-17 Cheb: 5.860967e-17

// LCOV_EXCL_START
BOOST_MATH_STATIC_LOCAL_VARIABLE const T Y = 1.0869731903076171875F;
BOOST_MATH_STATIC const T P[9] = {
BOOST_MATH_BIG_CONSTANT(T, 53, -0.00893891094356945667451),
Expand All @@ -665,6 +669,7 @@ BOOST_MATH_GPU_ENABLED T expint_i_imp(T z, const Policy& pol, const boost::math:
BOOST_MATH_BIG_CONSTANT(T, 53, 0.00278170769163303669021),
BOOST_MATH_BIG_CONSTANT(T, 53, 0.000159150281166108755531)
};
// LCOV_EXCL_STOP
T t = z / 5 - 3;
result = Y + tools::evaluate_polynomial(P, t)
/ tools::evaluate_polynomial(Q, t);
Expand All @@ -676,8 +681,7 @@ BOOST_MATH_GPU_ENABLED T expint_i_imp(T z, const Policy& pol, const boost::math:
// Maximum Deviation Found: 5.102e-18
// Expected Error Term: 5.101e-18
// Max Error found at double precision = Poly: 1.441088e-16 Cheb: 1.864792e-16


// LCOV_EXCL_START
BOOST_MATH_STATIC_LOCAL_VARIABLE const T Y = 1.03937530517578125F;
BOOST_MATH_STATIC const T P[9] = {
BOOST_MATH_BIG_CONSTANT(T, 53, -0.00356165148914447597995),
Expand All @@ -700,6 +704,7 @@ BOOST_MATH_GPU_ENABLED T expint_i_imp(T z, const Policy& pol, const boost::math:
BOOST_MATH_BIG_CONSTANT(T, 53, 0.0651165455496281337831),
BOOST_MATH_BIG_CONSTANT(T, 53, 0.00488071077519227853585)
};
// LCOV_EXCL_STOP
T t = z / 10 - 3;
result = Y + tools::evaluate_polynomial(P, t)
/ tools::evaluate_polynomial(Q, t);
Expand All @@ -709,6 +714,7 @@ BOOST_MATH_GPU_ENABLED T expint_i_imp(T z, const Policy& pol, const boost::math:
else
{
// Max Error found at double precision = 3.381886e-17
// LCOV_EXCL_START
BOOST_MATH_STATIC_LOCAL_VARIABLE const T exp40 = static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 53, 2.35385266837019985407899910749034804508871617254555467236651e17));
BOOST_MATH_STATIC_LOCAL_VARIABLE const T Y= 1.013065338134765625F;
BOOST_MATH_STATIC const T P[6] = {
Expand All @@ -728,6 +734,7 @@ BOOST_MATH_GPU_ENABLED T expint_i_imp(T z, const Policy& pol, const boost::math:
BOOST_MATH_BIG_CONSTANT(T, 53, 54738.2833147775537106),
BOOST_MATH_BIG_CONSTANT(T, 53, 8297.16296356518409347)
};
// LCOV_EXCL_STOP
T t = 1 / z;
result = Y + tools::evaluate_polynomial(P, t)
/ tools::evaluate_polynomial(Q, t);
Expand Down
2 changes: 1 addition & 1 deletion include/boost/math/special_functions/fpclassify.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ template<> inline BOOST_MATH_GPU_ENABLED int (fpclassify)(float t)
}
else if(at > FLT_MAX)
return FP_INFINITE;
return FP_NAN;
return FP_NAN; // LCOV_EXCL_LINE should not normally be reachable.
}

template<> inline BOOST_MATH_GPU_ENABLED int (fpclassify)(double t)
Expand Down
4 changes: 1 addition & 3 deletions include/boost/math/special_functions/jacobi_elliptic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ T jacobi_imp(const T& x, const T& k, T* cn, T* dn, const Policy& pol, const char
BOOST_MATH_STD_USING
if(k < 0)
{
*cn = policies::raise_domain_error<T>(function, "Modulus k must be positive but got %1%.", k, pol);
*dn = *cn;
return *cn;
return *dn = *cn = policies::raise_domain_error<T>(function, "Modulus k must be positive but got %1%.", k, pol);
}
if(k > 1)
{
Expand Down
Loading
Loading