From eef497efea6df4cc5ec1a704c0ecc1ee122b76a9 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 9 Feb 2024 18:25:31 +0000 Subject: [PATCH] Make bessel_k_prime integer order aware. --- .../detail/bessel_derivatives_linear.hpp | 8 ++++++++ test/test_bessel_k_prime.hpp | 16 ++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/include/boost/math/special_functions/detail/bessel_derivatives_linear.hpp b/include/boost/math/special_functions/detail/bessel_derivatives_linear.hpp index 42abbc15b..a391c33bf 100644 --- a/include/boost/math/special_functions/detail/bessel_derivatives_linear.hpp +++ b/include/boost/math/special_functions/detail/bessel_derivatives_linear.hpp @@ -75,6 +75,14 @@ inline T bessel_k_derivative_linear(T v, T x, const bessel_int_tag& tag, Policy return result + result2; } +template +inline T bessel_k_derivative_linear(T v, T x, const bessel_maybe_int_tag&, Policy pol) +{ + if (floor(v) == v) + return bessel_k_derivative_linear(v, x, bessel_int_tag(), pol); + return bessel_k_derivative_linear(v, x, bessel_no_int_tag(), pol); +} + template inline T bessel_y_derivative_linear(T v, T x, Tag tag, Policy pol) { diff --git a/test/test_bessel_k_prime.hpp b/test/test_bessel_k_prime.hpp index 7f0eb6151..f43728c11 100644 --- a/test/test_bessel_k_prime.hpp +++ b/test/test_bessel_k_prime.hpp @@ -185,31 +185,31 @@ void test_bessel(T, const char* name) { static const std::array, 8> coverage_data = { { #if LDBL_MAX_10_EXP > 310 - {{ SC_(20), static_cast(ldexp(T(1), -45)), SC_(-3.793503044583520787322174911740831752794438746336004555076e308) }}, + {{ SC_(20.0), static_cast(ldexp(T(1), -45)), SC_(-3.793503044583520787322174911740831752794438746336004555076e308) }}, {{ SC_(20.125), static_cast(ldexp(T(1), -45)), SC_(-2.979220621533376610700938325572770408419207521624698386062e310) }}, #else - {{ SC_(20), static_cast(ldexp(T(1), -45)), -std::numeric_limits::infinity() }}, + {{ SC_(20.0), static_cast(ldexp(T(1), -45)), -std::numeric_limits::infinity() }}, {{ SC_(20.125), static_cast(ldexp(T(1), -45)), -std::numeric_limits::infinity() }}, #endif #if LDBL_MAX_10_EXP > 346 - {{ SC_(20), static_cast(ldexp(T(1), -51)), SC_(-3.227155487331667007856383940813742118802894409545345203104e346) }}, + {{ SC_(20.0), static_cast(ldexp(T(1), -51)), SC_(-3.227155487331667007856383940813742118802894409545345203104e346) }}, {{ SC_(20.125), static_cast(ldexp(T(1), -51)), SC_(-4.262404050083097364466577035647085801041781477814968803189e348) }}, #else - {{ SC_(20), static_cast(ldexp(T(1), -51)), -std::numeric_limits::infinity() }}, + {{ SC_(20.0), static_cast(ldexp(T(1), -51)), -std::numeric_limits::infinity() }}, {{ SC_(20.125), static_cast(ldexp(T(1), -51)), -std::numeric_limits::infinity() }}, #endif #if LDBL_MAX_10_EXP > 4971 - {{ SC_(20), static_cast(ldexp(T(1), -778)), SC_(-2.15657066125095338369788943003323297569772178814715617602e4942) }}, + {{ SC_(20.0), static_cast(ldexp(T(1), -778)), SC_(-2.15657066125095338369788943003323297569772178814715617602e4942) }}, {{ SC_(20.125), static_cast(ldexp(T(1), -778)), SC_(-6.46694658438021098575183049117626387183087801364084017400e4971) }}, #else - {{ SC_(20), static_cast(ldexp(T(1), -778)), -std::numeric_limits::infinity() }}, + {{ SC_(20.0), static_cast(ldexp(T(1), -778)), -std::numeric_limits::infinity() }}, {{ SC_(20.125), static_cast(ldexp(T(1), -778)), -std::numeric_limits::infinity() }}, #endif #if LDBL_MAX_10_EXP > 5493 - {{ SC_(20), static_cast(ldexp(T(1), -860)), SC_(-5.09819245599453059425108127687500966644642217657888061634e5460) }}, + {{ SC_(20.0), static_cast(ldexp(T(1), -860)), SC_(-5.09819245599453059425108127687500966644642217657888061634e5460) }}, {{ SC_(20.125), static_cast(ldexp(T(1), -860)), SC_(-1.86169813082884487070647108868007382252541071831005047607e5493) }}, #else - {{ SC_(20), static_cast(ldexp(T(1), -860)), -std::numeric_limits::infinity() }}, + {{ SC_(20.0), static_cast(ldexp(T(1), -860)), -std::numeric_limits::infinity() }}, {{ SC_(20.125), static_cast(ldexp(T(1), -860)), -std::numeric_limits::infinity() }}, #endif } };