From 214e19cc5183992f899defe028978eeef95dd29c Mon Sep 17 00:00:00 2001 From: ckormanyos Date: Thu, 19 Dec 2024 18:33:28 +0100 Subject: [PATCH] Apply cyl_bessel_k0 logic change 113 bits --- include/boost/math/special_functions/detail/bessel_k0.hpp | 2 +- reporting/performance/test_kn.cpp | 4 +--- test/test_bessel_k.hpp | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/include/boost/math/special_functions/detail/bessel_k0.hpp b/include/boost/math/special_functions/detail/bessel_k0.hpp index bab202b6cd..a9387c865b 100644 --- a/include/boost/math/special_functions/detail/bessel_k0.hpp +++ b/include/boost/math/special_functions/detail/bessel_k0.hpp @@ -470,7 +470,7 @@ BOOST_MATH_GPU_ENABLED T bessel_k0_imp(const T& x, const boost::math::integral_c BOOST_MATH_BIG_CONSTANT(T, 113, 8.370574966987293592457152146806662562e+03), BOOST_MATH_BIG_CONSTANT(T, 113, 4.871254714311063594080644835895740323e+01) }; - if(x < tools::log_max_value()) + if(-x > tools::log_min_value()) return ((tools::evaluate_rational(P, Q, T(1 / x)) + Y) * exp(-x) / sqrt(x)); else { diff --git a/reporting/performance/test_kn.cpp b/reporting/performance/test_kn.cpp index 73798ce0e0..bf2c8cda19 100644 --- a/reporting/performance/test_kn.cpp +++ b/reporting/performance/test_kn.cpp @@ -48,9 +48,7 @@ static const std::array, 9> kn_data = { { { { SC_(-10.0), SC_(1.0), SC_(1.80713289901029454691597861302340015908245782948536080022119e8) } }, { { SC_(100.0), SC_(5.0), SC_(7.03986019306167654653386616796116726248616158936088056952477e115) } }, { { SC_(100.0), SC_(80.0), SC_(8.39287107246490782848985384895907681748152272748337807033319e-12) } }, - (std::numeric_limits::is_specialized && (std::numeric_limits::min_exponent10 > -300)) - ? std::array { { SC_(-1000.0), SC_(660.0), SC_(5.231804195291135637493087823300645230085362374177628598848978) } } - : std::array { { SC_(-1000.0), SC_(700.0), SC_(6.51561979144735818903553852606383312984409361984128221539405e-31) } }, + { { SC_(-1000.0), SC_(700.0), SC_(6.51561979144735818903553852606383312984409361984128221539405e-31) } }, } }; int main() diff --git a/test/test_bessel_k.hpp b/test/test_bessel_k.hpp index a1163f1d85..6a2a8179d9 100644 --- a/test/test_bessel_k.hpp +++ b/test/test_bessel_k.hpp @@ -133,9 +133,7 @@ void test_bessel(T, const char* name) {{ SC_(-10.0), SC_(1.0), SC_(1.80713289901029454691597861302340015908245782948536080022119e8) }}, {{ SC_(100.0), SC_(5.0), SC_(7.03986019306167654653386616796116726248616158936088056952477e115) }}, {{ SC_(100.0), SC_(80.0), SC_(8.39287107246490782848985384895907681748152272748337807033319e-12) }}, - (std::numeric_limits::is_specialized && (std::numeric_limits::min_exponent10 > -300)) - ? std::array::type, 3> {{ SC_(-1000.0), SC_(660.0), SC_(5.231804195291135637493087823300645230085362374177628598848978) }} - : std::array::type, 3> {{ SC_(-1000.0), SC_(700.0), SC_(6.51561979144735818903553852606383312984409361984128221539405e-31) }}, + {{ SC_(-1000.0), SC_(700.0), SC_(6.51561979144735818903553852606383312984409361984128221539405e-31) }}, }}; static const std::array::type, 3>, 11> kv_data = {{ {{ SC_(0.5), SC_(0.875), SC_(0.558532231646608646115729767013630967055657943463362504577189) }},