diff --git a/test/test_sin_cos.cpp b/test/test_sin_cos.cpp index 090cb2f8d..2e56f65fa 100644 --- a/test/test_sin_cos.cpp +++ b/test/test_sin_cos.cpp @@ -1,5 +1,5 @@ // Copyright 2024 Matt Borland -// Copyright 2024 Christopher Kormanyos +// Copyright 2024 - 2026 Christopher Kormanyos // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt @@ -59,7 +59,7 @@ auto test_sin() -> void auto ret_val {std::sin(val1)}; auto ret_dec {static_cast(sin(d1))}; - if (!BOOST_TEST(std::fabs(ret_val - ret_dec) < 40*std::numeric_limits::epsilon())) + if (!BOOST_TEST(std::fabs(ret_val - ret_dec) < 16*std::numeric_limits::epsilon())) { // LCOV_EXCL_START std::cerr << "Val 1: " << val1 @@ -270,9 +270,7 @@ namespace local from_chars(ctrl_strings[i], ctrl_strings[i] + std::strlen(ctrl_strings[i]), ctrl_values[i]) ); - const decimal_type local_tol = ((ctrl_values[i] < decimal_type { 1, -1 }) ? my_tol * 16 : my_tol); - - const auto result_sin_is_ok = is_close_fraction(sin_values[i], ctrl_values[i], local_tol); + const auto result_sin_is_ok = is_close_fraction(sin_values[i], ctrl_values[i], my_tol); result_is_ok = (result_sin_is_ok && result_is_ok); } @@ -360,9 +358,7 @@ namespace local from_chars(ctrl_strings[i], ctrl_strings[i] + std::strlen(ctrl_strings[i]), ctrl_values[i]) ); - const decimal_type local_tol = ((ctrl_values[i] < decimal_type { 1, -1 }) ? my_tol * 16 : my_tol); - - const auto result_cos_is_ok = is_close_fraction(cos_values[i], ctrl_values[i], local_tol); + const auto result_cos_is_ok = is_close_fraction(cos_values[i], ctrl_values[i], my_tol); result_is_ok = (result_cos_is_ok && result_is_ok); } @@ -498,24 +494,24 @@ auto main() -> int test_cos(); { - const auto result_sin128_is_ok = local::test_sin_128(0x800); - const auto result_cos128_is_ok = local::test_cos_128(0x800); + const auto result_sin128_is_ok = local::test_sin_128(16); + const auto result_cos128_is_ok = local::test_cos_128(16); BOOST_TEST(result_sin128_is_ok); BOOST_TEST(result_cos128_is_ok); } { - const auto result_sin128_is_ok = local::test_sin_128(0x800); - const auto result_cos128_is_ok = local::test_cos_128(0x800); + const auto result_sin128_is_ok = local::test_sin_128(16); + const auto result_cos128_is_ok = local::test_cos_128(16); BOOST_TEST(result_sin128_is_ok); BOOST_TEST(result_cos128_is_ok); } { - const auto result_sin064_tiny_is_ok = local::test_sin_tiny(0x400); - const auto result_sin128_tiny_is_ok = local::test_sin_tiny(0x400); + const auto result_sin064_tiny_is_ok = local::test_sin_tiny(16); + const auto result_sin128_tiny_is_ok = local::test_sin_tiny(16); BOOST_TEST(result_sin064_tiny_is_ok); BOOST_TEST(result_sin128_tiny_is_ok); diff --git a/test/test_tan.cpp b/test/test_tan.cpp index 48416cf61..47bb3f9bb 100644 --- a/test/test_tan.cpp +++ b/test/test_tan.cpp @@ -1,5 +1,5 @@ // Copyright 2023 Matt Borland -// Copyright 2023 Christopher Kormanyos +// Copyright 2023 - 2026 Christopher Kormanyos // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt @@ -26,25 +26,6 @@ auto my_zero() -> boost::decimal::decimal32_t&; namespace local { - template - auto time_point() noexcept -> IntegralTimePointType - { - using local_integral_time_point_type = IntegralTimePointType; - using local_clock_type = ClockType; - - const auto current_now = - static_cast - ( - std::chrono::duration_cast - ( - local_clock_type::now().time_since_epoch() - ).count() - ); - - return static_cast(current_now); - } - template auto is_close_fraction(const NumericType& a, const NumericType& b, @@ -75,7 +56,7 @@ namespace local std::random_device rd; std::mt19937_64 gen(rd()); - gen.seed(time_point()); + gen.seed(static_cast(42)); auto dis = std::uniform_real_distribution @@ -242,9 +223,9 @@ auto main() -> int { auto result_is_ok = true; - const auto result_pos_is_ok = local::test_tan(256, false, 0.03125L, 1.48L); - const auto result_neg_is_ok = local::test_tan(256, true, 0.03125L, 1.48L); - const auto result_pos_near_pi_half_is_ok = local::test_tan(4096, false, 1.48L, 1.56L); + const auto result_pos_is_ok = local::test_tan(96, false, 0.03125L, 1.48L); // High tolerance due to float conversion for comparison. + const auto result_neg_is_ok = local::test_tan(96, true, 0.03125L, 1.48L); // High tolerance due to float conversion for comparison. + const auto result_pos_near_pi_half_is_ok = local::test_tan(512, false, 1.48L, 1.56L); // High tolerance due to float conversion for comparison. const auto result_phase_is_ok = local::test_tan_phase();