2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

Repair test 1255 and adapt to double

This commit is contained in:
ckormanyos
2025-04-12 11:15:13 +02:00
parent d07b79d377
commit 30be128a84

View File

@@ -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 <boost/core/lightweight_test.hpp>
#include <boost/math/special_functions/bessel.hpp>
#include <cmath>
#include <limits>
auto main() -> int
namespace local
{
using float_type = float;
template<typename FloatType>
auto test() -> void
{
using float_type = FloatType;
const float_type x { 0x1.03ebbp-128F };
using std::ldexp;
const float_type ctrl { 0x1.41085ep+127F };
// N[BesselY[-1, (2875/1000) (2^(-128))], 51]
// 7.53497332069250908152363321534337029122980775749906*10^37
const float_type x { static_cast<float_type>(ldexp(2.875L, -128)) };
constexpr float_type ctrl { static_cast<float_type>(7.53497332069250908152363321534337029122980775749906E37L) };
const float_type result = ::boost::math::cyl_neumann(-1, x);
const float_type tol = std::numeric_limits<float_type>::epsilon() * 16;
constexpr float_type tol = std::numeric_limits<float_type>::epsilon() * 16;
using std::fabs;
using ::std::fabs;
BOOST_TEST(result > 0);
BOOST_TEST(fabs(1 - (result / ctrl)) < tol);
}
} // namespace local
auto main() -> int
{
local::test<double>();
local::test<long double>();
return boost::report_errors();
}