diff --git a/include/boost/decimal/detail/cmath/acosh.hpp b/include/boost/decimal/detail/cmath/acosh.hpp index 96b075675..83b1f377f 100644 --- a/include/boost/decimal/detail/cmath/acosh.hpp +++ b/include/boost/decimal/detail/cmath/acosh.hpp @@ -8,6 +8,7 @@ #include // NOLINT(llvm-include-order) #include +#include #include #include @@ -88,7 +89,7 @@ constexpr auto acosh_impl(const T x) noexcept constexpr T sixty_three_over_2560 { T { 63, 0 } / T { 2560, 0 } }; constexpr T seventy_seven_over_4096 { T { 77, 0 } / T { 4096, 0 } }; - result = ::boost::decimal::log(x) + numbers::ln2_v - inv_xsq * fma(inv_xsq, fma(inv_xsq, fma(inv_xsq, fma(inv_xsq, fma(inv_xsq, seventy_seven_over_4096, sixty_three_over_2560), thirty_five_over_1024), five_over_96), three_over_32), one_fourth); + result = ::boost::decimal::log(x) + numbers::ln2_v - inv_xsq * detail::unchecked_fma(inv_xsq, detail::unchecked_fma(inv_xsq, detail::unchecked_fma(inv_xsq, detail::unchecked_fma(inv_xsq, detail::unchecked_fma(inv_xsq, seventy_seven_over_4096, sixty_three_over_2560), thirty_five_over_1024), five_over_96), three_over_32), one_fourth); } else if (x < one_point_five) { @@ -97,12 +98,12 @@ constexpr auto acosh_impl(const T x) noexcept const auto two_y = y + y; - result = ::boost::decimal::log1p(y + sqrt(fma(y, y, two_y))); + result = ::boost::decimal::log1p(y + sqrt(detail::unchecked_fma(y, y, two_y))); } else { // http://functions.wolfram.com/ElementaryFunctions/ArcCosh/02/ - return(::boost::decimal::log(x + sqrt(fma(x, x, -one)))); + return(::boost::decimal::log(x + sqrt(detail::unchecked_fma(x, x, -one)))); } } else @@ -117,7 +118,7 @@ constexpr auto acosh_impl(const T x) noexcept constexpr T six_thousand_four_hundred_thirty_five_over_71303168 { T { 6435, 0 } / T { 71303168, 0 } }; // approximation by Taylor series in y at 0 through order 8 - result = sqrt(y + y) * fma(y, fma(y, fma(y, fma(y, fma(y, fma(y, fma(y, fma(y, six_thousand_four_hundred_thirty_five_over_71303168, four_hundred_twenty_nine_over_1966080), two_hundred_thirty_one_over_425984), sixty_three_over_90112), thirty_five_over_18432), five_over_896), three_over_160), one_twelfth), one); + result = sqrt(y + y) * detail::unchecked_fma(y, detail::unchecked_fma(y, detail::unchecked_fma(y, detail::unchecked_fma(y, detail::unchecked_fma(y, detail::unchecked_fma(y, detail::unchecked_fma(y, detail::unchecked_fma(y, six_thousand_four_hundred_thirty_five_over_71303168, four_hundred_twenty_nine_over_1966080), two_hundred_thirty_one_over_425984), sixty_three_over_90112), thirty_five_over_18432), five_over_896), three_over_160), one_twelfth), one); } } else diff --git a/include/boost/decimal/detail/cmath/asinh.hpp b/include/boost/decimal/detail/cmath/asinh.hpp index 81047dc20..1f858b344 100644 --- a/include/boost/decimal/detail/cmath/asinh.hpp +++ b/include/boost/decimal/detail/cmath/asinh.hpp @@ -8,6 +8,7 @@ #include // NOLINT(llvm-include-order) #include +#include #include #include @@ -63,7 +64,7 @@ constexpr auto asinh_impl(const T x) noexcept constexpr T thirty_five_over_1024 { -T { 35, 0 } / T { 1024, 0 } }; constexpr T sixty_three_over_2560 { T { 63, 0 } / T { 2560, 0 } }; - result = numbers::ln2_v + ::boost::decimal::log(x) + inv_xsq * fma(inv_xsq, fma(inv_xsq, fma(inv_xsq, fma(inv_xsq, sixty_three_over_2560, thirty_five_over_1024), five_over_96), three_over_32), one_fourth); + result = numbers::ln2_v + ::boost::decimal::log(x) + inv_xsq * detail::unchecked_fma(inv_xsq, detail::unchecked_fma(inv_xsq, detail::unchecked_fma(inv_xsq, detail::unchecked_fma(inv_xsq, sixty_three_over_2560, thirty_five_over_1024), five_over_96), three_over_32), one_fourth); } else if(x >= four_tenths) { @@ -88,7 +89,7 @@ constexpr auto asinh_impl(const T x) noexcept constexpr T five_over_112 { -T { 5, 0 } / T { 112, 0 } }; constexpr T thirty_five_over_1152 { T { 35, 0 } / T { 1152, 0 } }; - result = x * fma(xsq, fma(xsq, fma(xsq, fma(xsq, thirty_five_over_1152, five_over_112), three_over_40), one_sixth), one); + result = x * detail::unchecked_fma(xsq, detail::unchecked_fma(xsq, detail::unchecked_fma(xsq, detail::unchecked_fma(xsq, thirty_five_over_1152, five_over_112), three_over_40), one_sixth), one); } } } diff --git a/include/boost/decimal/detail/cmath/atanh.hpp b/include/boost/decimal/detail/cmath/atanh.hpp index a012187bb..63fc016ad 100644 --- a/include/boost/decimal/detail/cmath/atanh.hpp +++ b/include/boost/decimal/detail/cmath/atanh.hpp @@ -8,6 +8,7 @@ #include // NOLINT(llvm-include-order) #include +#include #include #include @@ -82,7 +83,7 @@ constexpr auto atanh_impl(const T x) noexcept constexpr T one_seventh { one / T { 7, 0 } }; constexpr T one_ninth { one / T { 9, 0 } }; - result = xx * fma(xsq, fma(xsq, fma(xsq, fma(xsq, one_ninth, one_seventh), one_fifth), one_third), one); + result = xx * unchecked_fma(xsq, unchecked_fma(xsq, unchecked_fma(xsq, unchecked_fma(xsq, one_ninth, one_seventh), one_fifth), one_third), one); } if (b_neg) { result = -result; } diff --git a/include/boost/decimal/detail/cmath/log.hpp b/include/boost/decimal/detail/cmath/log.hpp index 88f09286c..52a16cc51 100644 --- a/include/boost/decimal/detail/cmath/log.hpp +++ b/include/boost/decimal/detail/cmath/log.hpp @@ -58,7 +58,7 @@ constexpr auto log_impl(const T x) noexcept else if (x < one) { // Handle reflection. - result = -::boost::decimal::log(one / x); + result = -log10(one / x) * numbers::ln10_v; } else if(x > one) { diff --git a/include/boost/decimal/detail/cmath/log10.hpp b/include/boost/decimal/detail/cmath/log10.hpp index 0390b8126..5c7d4dc38 100644 --- a/include/boost/decimal/detail/cmath/log10.hpp +++ b/include/boost/decimal/detail/cmath/log10.hpp @@ -8,6 +8,7 @@ #include // NOLINT(llvm-include-order) #include +#include #include #include #include @@ -117,7 +118,7 @@ constexpr auto log10_impl(const T x) noexcept const T z { s + s }; const T zsq { z * z }; - result = z * fma(detail::log_series_expansion(zsq), zsq, one); + result = z * detail::unchecked_fma(detail::log_series_expansion(zsq), zsq, one); result /= numbers::ln10_v; diff --git a/test/test_acosh.cpp b/test/test_acosh.cpp index e901e7480..9fefea9f5 100644 --- a/test/test_acosh.cpp +++ b/test/test_acosh.cpp @@ -28,25 +28,6 @@ auto my_one () -> 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, @@ -77,7 +58,7 @@ namespace local // Use a pseudo-random seed value. std::mt19937_64 gen(std::random_device{}()); - gen.seed(time_point()); + gen.seed(static_cast(42)); auto dis = std::uniform_real_distribution @@ -371,9 +352,9 @@ auto main() -> int { auto result_is_ok = true; - const auto result_small_is_ok = local::test_acosh(INT32_C(32), 1.2L, 1.60L); - const auto result_medium_is_ok = local::test_acosh(INT32_C(16), 1.59L, 10.1L); - const auto result_large_is_ok = local::test_acosh(INT32_C(16), 1.0E+01L, 1.0E+26L); + const auto result_small_is_ok = local::test_acosh(INT32_C(32), 1.2L, 1.60L); // High tolerance due to float conversion for comparison. + const auto result_medium_is_ok = local::test_acosh(INT32_C(16), 1.59L, 10.1L); // High tolerance due to float conversion for comparison. + const auto result_large_is_ok = local::test_acosh(INT32_C(16), 1.0E+01L, 1.0E+26L); // High tolerance due to float conversion for comparison. BOOST_TEST(result_small_is_ok); BOOST_TEST(result_medium_is_ok); diff --git a/test/test_asinh.cpp b/test/test_asinh.cpp index 47bd07210..7de562905 100644 --- a/test/test_asinh.cpp +++ b/test/test_asinh.cpp @@ -27,25 +27,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::mt19937_64 gen(std::random_device{}()); - gen.seed(time_point()); + gen.seed(static_cast(42)); auto dis = std::uniform_real_distribution @@ -385,10 +366,10 @@ auto main() -> int { auto result_is_ok = true; - const auto result_tiny_is_ok = local::test_asinh(INT32_C(48), false, 1.001, 1.1); // High tolerance due to float conversion for comparison. - const auto result_small_is_ok = local::test_asinh(INT32_C(48), false, 0.1, 1.59); // High tolerance due to float conversion for comparison. - const auto result_small_neg_is_ok = local::test_asinh(INT32_C(48), true, 0.1, 1.59); // High tolerance due to float conversion for comparison. - const auto result_large_is_ok = local::test_asinh(INT32_C(48), false, 1.0E+01, 1.0E+19); // High tolerance due to float conversion for comparison. + const auto result_tiny_is_ok = local::test_asinh(INT32_C(48), false, 1.001, 1.1); // High tolerance due to float conversion for comparison. + const auto result_small_is_ok = local::test_asinh(INT32_C(32), false, 0.1, 1.59); // High tolerance due to float conversion for comparison. + const auto result_small_neg_is_ok = local::test_asinh(INT32_C(32), true, 0.1, 1.59); // High tolerance due to float conversion for comparison. + const auto result_large_is_ok = local::test_asinh(INT32_C(16), false, 1.0E+01, 1.0E+19); // High tolerance due to float conversion for comparison. BOOST_TEST(result_tiny_is_ok); BOOST_TEST(result_small_is_ok); diff --git a/test/test_atanh.cpp b/test/test_atanh.cpp index 7662c3505..7d964230f 100644 --- a/test/test_atanh.cpp +++ b/test/test_atanh.cpp @@ -28,25 +28,6 @@ auto my_one () -> 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, @@ -77,7 +58,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 @@ -298,7 +279,7 @@ auto main() -> int const auto result_eps_is_ok = local::test_atanh ( - INT32_C(128), + INT32_C(128), // High tolerance due to float conversion for comparison. false, static_cast(static_cast(fourth_root_epsilon) / 32.0), static_cast(static_cast(fourth_root_epsilon) * 32.0) @@ -307,15 +288,15 @@ auto main() -> int const auto result_eps_near_one_is_ok = local::test_atanh ( - INT32_C(256), + INT32_C(128), // High tolerance due to float conversion for comparison. false, - static_cast(static_cast( static_cast(1.0L) - static_cast(static_cast(fourth_root_epsilon) * 32.0L))), - static_cast(static_cast( static_cast(1.0L) - static_cast(static_cast(fourth_root_epsilon) / 32.0L))) + static_cast(1.0L) - static_cast(static_cast(fourth_root_epsilon) * 32.0L), + static_cast(1.0L) - static_cast(static_cast(fourth_root_epsilon) / 32.0L) ); - const auto result_tiny_is_ok = local::test_atanh(INT32_C(96), false, 0.001, 0.1); - const auto result_medium_is_ok = local::test_atanh(INT32_C(96), true, 0.1, 0.9); - const auto result_medium_neg_is_ok = local::test_atanh(INT32_C(96), false, 0.1, 0.9); + const auto result_tiny_is_ok = local::test_atanh(INT32_C(48), false, 0.001, 0.1); // High tolerance due to float conversion for comparison. + const auto result_medium_is_ok = local::test_atanh(INT32_C(48), true, 0.1, 0.9); // High tolerance due to float conversion for comparison. + const auto result_medium_neg_is_ok = local::test_atanh(INT32_C(48), false, 0.1, 0.9); // High tolerance due to float conversion for comparison. BOOST_TEST(result_eps_is_ok); BOOST_TEST(result_eps_near_one_is_ok); diff --git a/test/test_log.cpp b/test/test_log.cpp index 3c523dbb2..20f04df2e 100644 --- a/test/test_log.cpp +++ b/test/test_log.cpp @@ -1,16 +1,9 @@ // Copyright 2023 - 2024 Matt Borland -// Copyright 2023 - 2024 Christopher Kormanyos +// Copyright 2023 - 2026 Christopher Kormanyos // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include "testing_config.hpp" -#include -#include -#include -#include -#include -#include - #include #if defined(__clang__) @@ -23,6 +16,13 @@ #include +#include +#include +#include +#include +#include +#include + template auto my_zero() -> DecimalType&; template auto my_one () -> DecimalType&; template auto my_inf () -> DecimalType&; @@ -30,25 +30,6 @@ template auto my_nan () -> DecimalType&; 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, @@ -100,16 +81,23 @@ 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 { - static_cast(1.0E-17L), - static_cast(1.0E+17L) + static_cast(1.4L), + static_cast(8.9L) }; - auto result_is_ok = true; + auto dis_n = + std::uniform_int_distribution + { + -17, + 17 + }; + + auto result_is_ok { true }; auto trials = static_cast(UINT8_C(0)); @@ -121,7 +109,16 @@ namespace local for( ; trials < count; ++trials) { - const auto x_flt = dis(gen); + auto x_flt = dis(gen); + + std::string str_e { "1.0E" + std::to_string(dis_n(gen)) }; + + char* p_end; + + x_flt *= static_cast(strtold(str_e.c_str(), &p_end)); + + static_cast(p_end); + const auto x_dec = static_cast(x_flt); using std::log; @@ -199,7 +196,7 @@ namespace local std::mt19937_64 gen; - gen.seed(time_point()); + gen.seed(static_cast(42)); std::uniform_real_distribution dist @@ -488,7 +485,7 @@ auto main() -> int using float_type = float; const auto test_log_is_ok = local::test_log (32); - const auto test_log_between_1_and_2_is_ok = local::test_log_between_1_and_2(64); + const auto test_log_between_1_and_2_is_ok = local::test_log_between_1_and_2(32); const auto test_log_edge_is_ok = local::test_log_edge (32); result_is_ok = (test_log_is_ok && test_log_between_1_and_2_is_ok && test_log_edge_is_ok && result_is_ok); @@ -498,15 +495,15 @@ auto main() -> int using decimal_type = boost::decimal::decimal64_t; using float_type = double; - const auto test_log_is_ok = local::test_log (64); - const auto test_log_between_1_and_2_is_ok = local::test_log_between_1_and_2(512); - const auto test_log_edge_is_ok = local::test_log_edge (64); + const auto test_log_is_ok = local::test_log (32); + const auto test_log_between_1_and_2_is_ok = local::test_log_between_1_and_2(32); + const auto test_log_edge_is_ok = local::test_log_edge (32); result_is_ok = (test_log_is_ok && test_log_between_1_and_2_is_ok && test_log_edge_is_ok && result_is_ok); } { - const auto result_pos64_is_ok = local::test_log_64(256); + const auto result_pos64_is_ok = local::test_log_64(32); BOOST_TEST(result_pos64_is_ok); @@ -514,16 +511,14 @@ auto main() -> int } { - const auto result_pos128_is_ok = local::test_log_128(128); + const auto result_pos128_is_ok = local::test_log_128(32); BOOST_TEST(result_pos128_is_ok); result_is_ok = (result_pos128_is_ok && result_is_ok); } - result_is_ok = ((boost::report_errors() == 0) && result_is_ok); - - return (result_is_ok ? 0 : -1); + return boost::report_errors(); } template auto my_zero() -> DecimalType& { using decimal_type = DecimalType; static decimal_type my_zero_val { 0, 0 }; return my_zero_val; } diff --git a/test/test_log10.cpp b/test/test_log10.cpp index 56cedb21e..3dd0515c1 100644 --- a/test/test_log10.cpp +++ b/test/test_log10.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 @@ -29,25 +29,6 @@ template auto my_inf () -> DecimalType&; 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, @@ -72,13 +53,18 @@ namespace local result_is_ok = (delta < tol); } - // LCOV_EXCL_START if (!result_is_ok) + // LCOV_EXCL_START { - std::cerr << std::setprecision(std::numeric_limits::digits10) << "a: " << a - << "\nb: " << b - << "\ndelta: " << delta - << "\ntol: " << tol << std::endl; + std::stringstream strm; + + strm << std::setprecision(std::numeric_limits::digits10) + << "a : " << a + << "\nb : " << b + << "\ndelta: " << delta + << "\ntol : " << tol; + + std::cerr << strm.str() << std::endl; } // LCOV_EXCL_STOP @@ -94,16 +80,23 @@ namespace local std::random_device rd; std::mt19937_64 gen(rd()); - gen.seed(time_point()); + gen.seed(static_cast(42)); - auto dis_r = + auto dis = std::uniform_real_distribution { static_cast(1.4L), static_cast(8.9L) }; - bool result_is_ok { true }; + auto dis_n = + std::uniform_int_distribution + { + -17, + 17 + }; + + auto result_is_ok { true }; auto trials = static_cast(UINT8_C(0)); @@ -115,14 +108,7 @@ namespace local for( ; trials < count; ++trials) { - auto x_flt = dis_r(gen); - - auto dis_n = - std::uniform_int_distribution - { - -17, - 17 - }; + auto x_flt = dis(gen); std::string str_e { "1.0E" + std::to_string(dis_n(gen)) }; @@ -195,7 +181,7 @@ namespace local std::mt19937_64 gen; - gen.seed(time_point()); + gen.seed(static_cast(42)); std::uniform_real_distribution dist @@ -312,6 +298,51 @@ namespace local return result_is_ok; } + template + auto test_log10_near_one(const int tol_factor) -> bool + { + using decimal_type = DecimalType; + + using str_ctrl_array_type = std::array; + + const str_ctrl_array_type ctrl_strings = + {{ + // Table[N[Log10[1 + 10^(-n)], 40], {n, 0, 6, 1}] + "0.3010299956639811952137388947244930267682", + "0.04139268515822504075019997124302424170670", + "0.004321373782642574275188178222937913219289", + "0.0004340774793186406689213877779888660200038", + "0.00004342727686266963731352758509826813109796", + "4.342923104453186855493471634397183972444E-6", + "4.342942647561556407439426436777070416841E-7", + }}; + + std::array::value> log_values { }; + std::array::value> ctrl_values { }; + + bool result_is_ok { true }; + + const decimal_type my_tol { std::numeric_limits::epsilon() * static_cast(tol_factor) }; + + for(auto i = static_cast(UINT8_C(0)); i < std::tuple_size::value; ++i) + { + const decimal_type x_arg { ::my_one() + decimal_type { 1, -static_cast(i) } }; + + log_values[i] = log10(x_arg); + + static_cast + ( + from_chars(ctrl_strings[i], ctrl_strings[i] + std::strlen(ctrl_strings[i]), ctrl_values[i]) + ); + + const auto result_log_is_ok = is_close_fraction(log_values[i], ctrl_values[i], my_tol); + + result_is_ok = (result_log_is_ok && result_is_ok); + } + + return result_is_ok; + } + auto test_log10_128(const int tol_factor) -> bool { using decimal_type = boost::decimal::decimal128_t; @@ -391,10 +422,8 @@ auto main() -> int using decimal_type = boost::decimal::decimal32_t; using float_type = float; - const auto test_log10_is_ok = local::test_log10(128); - + const auto test_log10_is_ok = local::test_log10(32); BOOST_TEST(test_log10_is_ok); - result_is_ok = (test_log10_is_ok && result_is_ok); } @@ -402,10 +431,8 @@ auto main() -> int using decimal_type = boost::decimal::decimal_fast32_t; using float_type = float; - const auto test_log10_is_ok = local::test_log10(128); - + const auto test_log10_is_ok = local::test_log10(32); BOOST_TEST(test_log10_is_ok); - result_is_ok = (test_log10_is_ok && result_is_ok); } @@ -413,10 +440,8 @@ auto main() -> int using decimal_type = boost::decimal::decimal64_t; using float_type = double; - const auto test_log10_is_ok = local::test_log10(512); - + const auto test_log10_is_ok = local::test_log10(32); BOOST_TEST(test_log10_is_ok); - result_is_ok = (test_log10_is_ok && result_is_ok); } @@ -424,10 +449,8 @@ auto main() -> int using decimal_type = boost::decimal::decimal_fast64_t; using float_type = double; - const auto test_log10_is_ok = local::test_log10(512); - + const auto test_log10_is_ok = local::test_log10(32); BOOST_TEST(test_log10_is_ok); - result_is_ok = (test_log10_is_ok && result_is_ok); } @@ -436,10 +459,33 @@ auto main() -> int using float_type = float; const auto test_log10_pow10_is_ok = local::test_log10_pow10(); - BOOST_TEST(test_log10_pow10_is_ok); + result_is_ok = (test_log10_pow10_is_ok && result_is_ok); + const auto test_log10_near_one_is_ok = local::test_log10_near_one(4); + BOOST_TEST(test_log10_near_one_is_ok); + result_is_ok = (test_log10_near_one_is_ok && result_is_ok); + } + + { + using decimal_type = boost::decimal::decimal64_t; + using float_type = double; + + const auto test_log10_pow10_is_ok = local::test_log10_pow10(); + BOOST_TEST(test_log10_pow10_is_ok); result_is_ok = (test_log10_pow10_is_ok && result_is_ok); + + const auto test_log10_near_one_is_ok = local::test_log10_near_one(4); + BOOST_TEST(test_log10_near_one_is_ok); + result_is_ok = (test_log10_near_one_is_ok && result_is_ok); + } + + { + using decimal_type = boost::decimal::decimal128_t; + + const auto test_log10_near_one_is_ok = local::test_log10_near_one(4); + BOOST_TEST(test_log10_near_one_is_ok); + result_is_ok = (test_log10_near_one_is_ok && result_is_ok); } { @@ -447,9 +493,7 @@ auto main() -> int using float_type = float; const auto test_log10_edge_is_ok = local::test_log10_edge(); - BOOST_TEST(test_log10_edge_is_ok); - result_is_ok = (test_log10_edge_is_ok && result_is_ok); } @@ -458,17 +502,13 @@ auto main() -> int using float_type = double; const auto test_log10_edge_is_ok = local::test_log10_edge(); - BOOST_TEST(test_log10_edge_is_ok); - result_is_ok = (test_log10_edge_is_ok && result_is_ok); } { - const auto result_pos128_is_ok = local::test_log10_128(8192); - + const auto result_pos128_is_ok = local::test_log10_128(32); BOOST_TEST(result_pos128_is_ok); - result_is_ok = (result_pos128_is_ok && result_is_ok); }