From 23059d558e8310117d7757528703af0d9416d674 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 3 Aug 2025 10:00:24 -0700 Subject: [PATCH] Fix exponent size computation --- include/fmt/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 43cf7f54..f1fb2ccd 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1486,7 +1486,7 @@ template constexpr auto exponent_bias() -> int { FMT_CONSTEXPR inline auto compute_exp_size(int exp) -> int { auto prefix_size = 2; // sign + 'e' auto abs_exp = exp >= 0 ? exp : -exp; - if (exp < 100) return prefix_size + 2; + if (abs_exp < 100) return prefix_size + 2; return prefix_size + (abs_exp >= 1000 ? 4 : 3); }