diff --git a/include/boost/math/special_functions/detail/bessel_jy.hpp b/include/boost/math/special_functions/detail/bessel_jy.hpp index a41e2744d3..90e099eb77 100644 --- a/include/boost/math/special_functions/detail/bessel_jy.hpp +++ b/include/boost/math/special_functions/detail/bessel_jy.hpp @@ -310,14 +310,14 @@ namespace boost { namespace math { else if(kind & need_j) *J = policies::raise_domain_error(function, "Value of Bessel J_v(x) is complex-infinity at %1%", x, pol); // complex infinity else - *J = std::numeric_limits::quiet_NaN(); // any value will do, not using J. + *J = std::numeric_limits::quiet_NaN(); // LCOV_EXCL_LINE, we should never get here, any value will do, not using J. if((kind & need_y) == 0) *Y = std::numeric_limits::quiet_NaN(); // any value will do, not using Y. else { // We shoud never get here: - BOOST_MATH_ASSERT(x != 0); + BOOST_MATH_ASSERT(x != 0); // LCOV_EXCL_LINE } return 1; } @@ -420,9 +420,9 @@ namespace boost { namespace math { { if(temme_jy(u, x, &Yu, &Yu1, pol)) // Temme series { - // domain error, this should really have already been handled, LCOV_EXCL_LINE - *J = *Y = Yu; - return 1; + // domain error, this should really have already been handled. + *J = *Y = Yu; // LCOV_EXCL_LINE + return 1; // LCOV_EXCL_LINE } prev = Yu; current = Yu1; diff --git a/include/boost/math/special_functions/detail/bessel_jy_series.hpp b/include/boost/math/special_functions/detail/bessel_jy_series.hpp index ebcb62f910..db46f36400 100644 --- a/include/boost/math/special_functions/detail/bessel_jy_series.hpp +++ b/include/boost/math/special_functions/detail/bessel_jy_series.hpp @@ -156,10 +156,13 @@ inline T bessel_y_small_z_series(T v, T x, T* pscale, const Policy& pol) { scale /= gam; gam = 1; + /* + * We can never get here, it would require p < 1/max_value. if(tools::max_value() * p < gam) { return -policies::raise_overflow_error(function, nullptr, pol); } + */ } prefix = -gam / (constants::pi() * p); } @@ -244,14 +247,15 @@ T bessel_yn_small_z(int n, T z, T* scale, const Policy& pol) #endif T result = -((boost::math::factorial(n - 1, pol) / constants::pi())); - if(p * tools::max_value() < result) + if(p * tools::max_value() < fabs(result)) { T div = tools::max_value() / 8; result /= div; *scale /= div; if(p * tools::max_value() < result) { - return -policies::raise_overflow_error("bessel_yn_small_z<%1%>(%1%,%1%)", nullptr, pol); + // Impossible to get here?? + return -policies::raise_overflow_error("bessel_yn_small_z<%1%>(%1%,%1%)", nullptr, pol); // LCOV_EXCL_LINE } } return result / p; diff --git a/include/boost/math/special_functions/detail/bessel_jy_zero.hpp b/include/boost/math/special_functions/detail/bessel_jy_zero.hpp index 3fdb413d9f..cb1fc48d83 100644 --- a/include/boost/math/special_functions/detail/bessel_jy_zero.hpp +++ b/include/boost/math/special_functions/detail/bessel_jy_zero.hpp @@ -315,7 +315,7 @@ } else { - root_lo *= 0.75F; + root_lo *= 0.75F; // LCOV_EXCL_LINE probably unreachable, but hard to prove? } } } diff --git a/include/boost/math/special_functions/detail/bessel_y0.hpp b/include/boost/math/special_functions/detail/bessel_y0.hpp index 952b284185..ed43189f8d 100644 --- a/include/boost/math/special_functions/detail/bessel_y0.hpp +++ b/include/boost/math/special_functions/detail/bessel_y0.hpp @@ -39,7 +39,7 @@ template T bessel_y0(T x, const Policy&); template -T bessel_y0(T x, const Policy& pol) +T bessel_y0(T x, const Policy&) { static const T P1[] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0723538782003176831e+11)), diff --git a/include/boost/math/special_functions/detail/bessel_y1.hpp b/include/boost/math/special_functions/detail/bessel_y1.hpp index b7c5c2f7ef..3ac696bb5c 100644 --- a/include/boost/math/special_functions/detail/bessel_y1.hpp +++ b/include/boost/math/special_functions/detail/bessel_y1.hpp @@ -39,7 +39,7 @@ template T bessel_y1(T x, const Policy&); template -T bessel_y1(T x, const Policy& pol) +T bessel_y1(T x, const Policy&) { static const T P1[] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 4.0535726612579544093e+13)), diff --git a/test/test_bessel_y.hpp b/test/test_bessel_y.hpp index a6fa036681..ccbf61f78c 100644 --- a/test/test_bessel_y.hpp +++ b/test/test_bessel_y.hpp @@ -246,7 +246,7 @@ void test_bessel(T, const char* name) #endif BOOST_IF_CONSTEXPR(std::numeric_limits::has_infinity && (std::numeric_limits::min_exponent < -1072)) { - static const std::array, 5> coverage_data = { { + static const std::array, 7> coverage_data = { { #if LDBL_MAX_10_EXP > 4931 {{ SC_(15.25), ldexp(T(1), -1071), SC_(-9.39553199265929955912687892204143267985847111378392154596e4931)}}, #else @@ -264,6 +264,12 @@ void test_bessel(T, const char* name) #endif {{ SC_(233.0), ldexp(T(1), -63), -std::numeric_limits::infinity() }}, {{ SC_(233.0), ldexp(T(1), -64), -std::numeric_limits::infinity() }}, +#if LDBL_MAX_10_EXP > 413 + {{ SC_(200.25), SC_(1.25), SC_(-3.545198572052800784992190965856441074217589237581037286156e413)}}, +#else + {{ SC_(200.25), SC_(1.25), -std::numeric_limits::infinity()}}, +#endif + {{ SC_(1652.25), SC_(1.25), -std::numeric_limits::infinity()}}, } }; do_test_cyl_neumann_y(coverage_data, name, "Extra Coverage Data");