diff options
author | Victor Zverovich <viz@fb.com> | 2020-09-23 15:12:03 -0700 |
---|---|---|
committer | Victor Zverovich <viz@fb.com> | 2020-09-23 15:44:37 -0700 |
commit | 6c025520aa8371eb40ac06e6d4569575d7e65802 (patch) | |
tree | a611166e7ec1bae328edf6b0473c6501a17633b1 /test/format-impl-test.cc | |
parent | 51f8d0cc21748c613ef16bd2089507e8815ac88a (diff) | |
download | fmtlib-6c025520aa8371eb40ac06e6d4569575d7e65802.tar.gz |
Test that max_k is correctly defined
Diffstat (limited to 'test/format-impl-test.cc')
-rw-r--r-- | test/format-impl-test.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/format-impl-test.cc b/test/format-impl-test.cc index b0df24aa..dbb635bc 100644 --- a/test/format-impl-test.cc +++ b/test/format-impl-test.cc @@ -220,6 +220,19 @@ TEST(FPTest, GetCachedPower) { } } +TEST(FPTest, DragonboxMaxK) { + using fmt::detail::dragonbox::floor_log10_pow2; + using float_info = fmt::detail::dragonbox::float_info<float>; + EXPECT_EQ(fmt::detail::const_check(float_info::max_k), + float_info::kappa - floor_log10_pow2(float_info::min_exponent - + float_info::significand_bits)); + using double_info = fmt::detail::dragonbox::float_info<double>; + EXPECT_EQ( + fmt::detail::const_check(double_info::max_k), + double_info::kappa - floor_log10_pow2(double_info::min_exponent - + double_info::significand_bits)); +} + TEST(FPTest, GetRoundDirection) { using fmt::detail::get_round_direction; using fmt::detail::round_direction; |