From 30be128a84e0fb4722519ee80be84702bcf8f763 Mon Sep 17 00:00:00 2001 From: ckormanyos Date: Sat, 12 Apr 2025 11:15:13 +0200 Subject: [PATCH] Repair test 1255 and adapt to double --- test/git_issue_1255.cpp | 45 ++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/test/git_issue_1255.cpp b/test/git_issue_1255.cpp index 56d692331..133986a2d 100644 --- a/test/git_issue_1255.cpp +++ b/test/git_issue_1255.cpp @@ -3,28 +3,45 @@ // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// See also: https://godbolt.org/z/nhMsKb8Yr + #include #include #include #include +namespace local +{ + template + auto test() -> void + { + using float_type = FloatType; + + using std::ldexp; + + // N[BesselY[-1, (2875/1000) (2^(-128))], 51] + // 7.53497332069250908152363321534337029122980775749906*10^37 + + const float_type x { static_cast(ldexp(2.875L, -128)) }; + + constexpr float_type ctrl { static_cast(7.53497332069250908152363321534337029122980775749906E37L) }; + + const float_type result = ::boost::math::cyl_neumann(-1, x); + + constexpr float_type tol = std::numeric_limits::epsilon() * 16; + + using ::std::fabs; + + BOOST_TEST(result > 0); + BOOST_TEST(fabs(1 - (result / ctrl)) < tol); + } +} // namespace local + auto main() -> int { - using float_type = float; - - const float_type x { 0x1.03ebbp-128F }; - - const float_type ctrl { 0x1.41085ep+127F }; - - const float_type result = ::boost::math::cyl_neumann(-1, x); - - const float_type tol = std::numeric_limits::epsilon() * 16; - - using std::fabs; - - BOOST_TEST(result > 0); - BOOST_TEST(fabs(1 - (result / ctrl)) < tol); + local::test(); + local::test(); return boost::report_errors(); }