From 6c025520aa8371eb40ac06e6d4569575d7e65802 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 23 Sep 2020 15:12:03 -0700 Subject: Test that max_k is correctly defined --- test/format-impl-test.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/format-impl-test.cc') 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; + 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; + 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; -- cgit v1.2.3