11// /////////////////////////////////////////////////////////////
2- // Copyright Christopher Kormanyos 2024 - 2025 .
2+ // Copyright Christopher Kormanyos 2024 - 2026 .
33// Distributed under the Boost
44// Software License, Version 1.0. (See accompanying file
55// LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
@@ -120,11 +120,9 @@ struct stopwatch
120120namespace util {
121121
122122template <typename UnsignedIntegralType>
123- auto util_pseudorandom_time_point_seed () -> UnsignedIntegralType
123+ auto util_fixed_seed () -> UnsignedIntegralType
124124{
125- using stopwatch_type = concurrency::stopwatch;
126-
127- return static_cast <UnsignedIntegralType>(stopwatch_type::now ());
125+ return UnsignedIntegralType { UINT8_C (42 ) };
128126}
129127
130128} // namespace util
@@ -192,8 +190,6 @@ auto do_trials(const std::size_t trial_count) -> void
192190 static std::size_t heat_count { };
193191 static std::size_t total_count { };
194192
195- std::cout << " \n heat_count: " << ++heat_count << std::endl;
196-
197193 using dbl_float_type = boost::multiprecision::cpp_double_double;
198194
199195 constexpr int local_digits10 = ((std::numeric_limits<dbl_float_type>::digits10 < 32 ) ? 32 : std::numeric_limits<dbl_float_type>::digits10);
@@ -222,8 +218,8 @@ auto do_trials(const std::size_t trial_count) -> void
222218 {
223219 if (std::size_t { total_count % unsigned { UINT32_C (0x1000 ) } } == std::size_t { UINT8_C (0 ) })
224220 {
225- eng_sgn.seed (util::util_pseudorandom_time_point_seed <typename eng_sgn_type::result_type>());
226- eng_dig.seed (util::util_pseudorandom_time_point_seed <typename eng_dig_type::result_type>());
221+ eng_sgn.seed (util::util_fixed_seed <typename eng_sgn_type::result_type>());
222+ eng_dig.seed (util::util_fixed_seed <typename eng_dig_type::result_type>());
227223 }
228224
229225 ++total_count;
@@ -321,27 +317,18 @@ auto do_trials(const std::size_t trial_count) -> void
321317 const double elapsed_flt { stopwatch_type::elapsed_time<double >(my_stopwatch) };
322318 #endif
323319
324- std::stringstream strm { };
325-
326- strm << std::fixed << std::setprecision (3 ) << " elapsed_dbl : " << elapsed_dbl << " s\n "
327- << std::fixed << std::setprecision (3 ) << " elapsed_dec : " << elapsed_dec << " s\n "
328- << std::fixed << std::setprecision (3 ) << " elapsed_bin : " << elapsed_bin << " s\n "
329- #if defined(BOOST_HAS_FLOAT128)
330- << std::fixed << std::setprecision (3 ) << " elapsed_flt : " << elapsed_flt << " s\n "
331- #endif
332- << std::fixed << std::setprecision (3 ) << " ratio (dec/dbl) : " << elapsed_dec / elapsed_dbl << " \n "
333- << std::fixed << std::setprecision (3 ) << " ratio (bin/dbl) : " << elapsed_bin / elapsed_dbl << " \n "
334- #if defined(BOOST_HAS_FLOAT128)
335- << std::fixed << std::setprecision (3 ) << " ratio (flt/dbl) : " << elapsed_flt / elapsed_dbl << " \n "
336- #endif
337- ;
338-
339320 BOOST_TEST (elapsed_dec / elapsed_dbl > 1.0 );
340321 BOOST_TEST (elapsed_bin / elapsed_dbl > 1.0 );
341322
342- std::cout << strm.str () << std::endl;
343-
344- std::cout << " verifying results...\n " ;
323+ #if 0
324+ std::cout << "elapsed_dec: " << elapsed_dec
325+ << ", elapsed_bin: " << elapsed_bin
326+ << ", elapsed_dbl: " << elapsed_dbl
327+ << ", elapsed_dec / elapsed_dbl: " << elapsed_dec / elapsed_dbl
328+ << ", elapsed_bin / elapsed_dbl: " << elapsed_bin / elapsed_dbl
329+ << std::endl
330+ ;
331+ #endif
345332
346333 std::size_t count { UINT8_C (0 ) };
347334
@@ -355,19 +342,32 @@ auto do_trials(const std::size_t trial_count) -> void
355342 const dbl_float_type ctrl_flt { flt_float_c_vec[count] };
356343 #endif
357344
358- BOOST_TEST (is_close_fraction (lhs, ctrl_dec, tol_dbl));
359- BOOST_TEST (is_close_fraction (lhs, ctrl_bin, tol_dbl));
345+ const bool result_dec_is_ok { is_close_fraction (lhs, ctrl_dec, tol_dbl) };
346+ const bool result_bin_is_ok { is_close_fraction (lhs, ctrl_bin, tol_dbl) };
347+ #if defined(BOOST_HAS_FLOAT128)
348+ const bool result_flt_is_ok { is_close_fraction (lhs, ctrl_flt, tol_dbl) };
349+ #endif
350+
351+ BOOST_TEST (result_dec_is_ok);
352+ 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; }
353+
354+ BOOST_TEST (result_bin_is_ok);
355+ 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; }
356+
360357 #if defined(BOOST_HAS_FLOAT128)
361- BOOST_TEST (is_close_fraction (lhs, ctrl_flt, tol_dbl));
358+ BOOST_TEST (result_flt_is_ok);
359+ 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; }
362360 #endif
363361
364362 ++count;
365363 }
366364}
367365
366+ auto main () -> int;
367+
368368auto main () -> int
369369{
370- constexpr std::size_t trials { UINT32_C (0x4000 ) };
370+ constexpr std::size_t trials { UINT32_C (0x400 ) };
371371 constexpr std::size_t heats { UINT32_C (0x4 ) };
372372
373373 for (std::size_t heat_count { UINT8_C (0 ) }; heat_count < heats; ++heat_count)
0 commit comments