From c380088f992c60acc3b8c5be25aa601e27329e06 Mon Sep 17 00:00:00 2001 From: ckormanyos Date: Wed, 15 Apr 2026 23:19:54 +0200 Subject: [PATCH 1/4] Use fixed seed double-fp heats versus others --- ...test_cpp_double_float_bessel_versus_bin_and_dec.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp b/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp index 13c393a04..03b9fd741 100644 --- a/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp +++ b/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp @@ -120,11 +120,11 @@ struct stopwatch namespace util { template -auto util_pseudorandom_time_point_seed() -> UnsignedIntegralType +auto util_fixed_seed() -> UnsignedIntegralType { using stopwatch_type = concurrency::stopwatch; - return static_cast(stopwatch_type::now()); + return static_cast(42U); } } // namespace util @@ -222,8 +222,8 @@ auto do_trials(const std::size_t trial_count) -> void { if(std::size_t { total_count % unsigned { UINT32_C(0x1000) } } == std::size_t { UINT8_C(0) }) { - eng_sgn.seed(util::util_pseudorandom_time_point_seed()); - eng_dig.seed(util::util_pseudorandom_time_point_seed()); + eng_sgn.seed(util::util_fixed_seed()); + eng_dig.seed(util::util_fixed_seed()); } ++total_count; @@ -367,7 +367,7 @@ auto do_trials(const std::size_t trial_count) -> void auto main() -> int { - constexpr std::size_t trials { UINT32_C(0x4000) }; + constexpr std::size_t trials { UINT32_C(0x800) }; constexpr std::size_t heats { UINT32_C(0x4) }; for(std::size_t heat_count { UINT8_C(0) }; heat_count < heats; ++heat_count) From ab6bfb07dff1679a7834a30cb6ef1a9757e3100d Mon Sep 17 00:00:00 2001 From: ckormanyos Date: Wed, 15 Apr 2026 23:23:30 +0200 Subject: [PATCH 2/4] Remove an unused alias --- test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp b/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp index 03b9fd741..c32caa167 100644 --- a/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp +++ b/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp @@ -122,9 +122,7 @@ namespace util { template auto util_fixed_seed() -> UnsignedIntegralType { - using stopwatch_type = concurrency::stopwatch; - - return static_cast(42U); + return UnsignedIntegralType { UINT8_C(42) }; } } // namespace util From efdae587aaabc65ccc8b52fbd2cd675181534622 Mon Sep 17 00:00:00 2001 From: ckormanyos Date: Thu, 16 Apr 2026 10:09:05 +0200 Subject: [PATCH 3/4] Further cleanup of test case --- ...double_float_bessel_versus_bin_and_dec.cpp | 42 ++++++++----------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp b/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp index c32caa167..e5536b58b 100644 --- a/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp +++ b/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2024 - 2025. +// Copyright Christopher Kormanyos 2024 - 2026. // Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt @@ -190,8 +190,6 @@ auto do_trials(const std::size_t trial_count) -> void static std::size_t heat_count { }; static std::size_t total_count { }; - std::cout << "\nheat_count: " << ++heat_count << std::endl; - using dbl_float_type = boost::multiprecision::cpp_double_double; constexpr int local_digits10 = ((std::numeric_limits::digits10 < 32) ? 32 : std::numeric_limits::digits10); @@ -319,28 +317,9 @@ auto do_trials(const std::size_t trial_count) -> void const double elapsed_flt { stopwatch_type::elapsed_time(my_stopwatch) }; #endif - std::stringstream strm { }; - - strm << std::fixed << std::setprecision(3) << "elapsed_dbl : " << elapsed_dbl << "s\n" - << std::fixed << std::setprecision(3) << "elapsed_dec : " << elapsed_dec << "s\n" - << std::fixed << std::setprecision(3) << "elapsed_bin : " << elapsed_bin << "s\n" - #if defined(BOOST_HAS_FLOAT128) - << std::fixed << std::setprecision(3) << "elapsed_flt : " << elapsed_flt << "s\n" - #endif - << std::fixed << std::setprecision(3) << "ratio (dec/dbl) : " << elapsed_dec / elapsed_dbl << "\n" - << std::fixed << std::setprecision(3) << "ratio (bin/dbl) : " << elapsed_bin / elapsed_dbl << "\n" - #if defined(BOOST_HAS_FLOAT128) - << std::fixed << std::setprecision(3) << "ratio (flt/dbl) : " << elapsed_flt / elapsed_dbl << "\n" - #endif - ; - BOOST_TEST(elapsed_dec / elapsed_dbl > 1.0); BOOST_TEST(elapsed_bin / elapsed_dbl > 1.0); - std::cout << strm.str() << std::endl; - - std::cout << "verifying results...\n"; - std::size_t count { UINT8_C(0) }; constexpr dbl_float_type tol_dbl { std::numeric_limits::epsilon() * 0x1000000 }; @@ -353,16 +332,29 @@ auto do_trials(const std::size_t trial_count) -> void const dbl_float_type ctrl_flt { flt_float_c_vec[count] }; #endif - BOOST_TEST(is_close_fraction(lhs, ctrl_dec, tol_dbl)); - BOOST_TEST(is_close_fraction(lhs, ctrl_bin, tol_dbl)); + const bool result_dec_is_ok { is_close_fraction(lhs, ctrl_dec, tol_dbl) }; + const bool result_bin_is_ok { is_close_fraction(lhs, ctrl_bin, tol_dbl) }; #if defined(BOOST_HAS_FLOAT128) - BOOST_TEST(is_close_fraction(lhs, ctrl_flt, tol_dbl)); + const bool result_flt_is_ok { is_close_fraction(lhs, ctrl_flt, tol_dbl) }; + #endif + + BOOST_TEST(result_dec_is_ok); + if(!result_dec_is_ok) { std::stringstream strm { }; strm << std::setprecision(local_digits10) << "expected: " << ctrl_dec << ", got: " << lhs << ", a: " << dec_float_a_vec.at(count) << ", b: " << dec_float_b_vec.at(count); std::cout << strm.str() << std::endl; } + + BOOST_TEST(result_bin_is_ok); + if(!result_bin_is_ok) { std::stringstream strm { }; strm << std::setprecision(local_digits10) << "expected: " << ctrl_bin << ", got: " << lhs << ", a: " << bin_float_a_vec.at(count) << ", b: " << bin_float_b_vec.at(count); std::cout << strm.str() << std::endl; } + + #if defined(BOOST_HAS_FLOAT128) + BOOST_TEST(result_flt_is_ok); + if(!result_flt_is_ok) { std::stringstream strm { }; strm << std::setprecision(local_digits10) << "expected: " << ctrl_flt << ", got: " << lhs << ", a: " << flt_float_a_vec.at(count) << ", b: " << flt_float_b_vec.at(count); std::cout << strm.str() << std::endl; } #endif ++count; } } +auto main() -> int; + auto main() -> int { constexpr std::size_t trials { UINT32_C(0x800) }; From 021d3e7e2bb2971f5a2f90223e0db57a4f6f6b7e Mon Sep 17 00:00:00 2001 From: ckormanyos Date: Thu, 16 Apr 2026 10:20:43 +0200 Subject: [PATCH 4/4] Reduce test trials --- ...st_cpp_double_float_bessel_versus_bin_and_dec.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp b/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp index e5536b58b..e45eeac3b 100644 --- a/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp +++ b/test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp @@ -320,6 +320,16 @@ auto do_trials(const std::size_t trial_count) -> void BOOST_TEST(elapsed_dec / elapsed_dbl > 1.0); BOOST_TEST(elapsed_bin / elapsed_dbl > 1.0); + #if 0 + std::cout << "elapsed_dec: " << elapsed_dec + << ", elapsed_bin: " << elapsed_bin + << ", elapsed_dbl: " << elapsed_dbl + << ", elapsed_dec / elapsed_dbl: " << elapsed_dec / elapsed_dbl + << ", elapsed_bin / elapsed_dbl: " << elapsed_bin / elapsed_dbl + << std::endl + ; + #endif + std::size_t count { UINT8_C(0) }; constexpr dbl_float_type tol_dbl { std::numeric_limits::epsilon() * 0x1000000 }; @@ -357,7 +367,7 @@ auto main() -> int; auto main() -> int { - constexpr std::size_t trials { UINT32_C(0x800) }; + constexpr std::size_t trials { UINT32_C(0x400) }; constexpr std::size_t heats { UINT32_C(0x4) }; for(std::size_t heat_count { UINT8_C(0) }; heat_count < heats; ++heat_count)