diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 582c6193..fb4b4b1c 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -441,7 +441,7 @@ class fp { std::numeric_limits::digits - 1); if (min_normal_e > e) half_ulp <<= min_normal_e - e; upper = normalize<0>(fp(f + half_ulp, e)); - lower = fp(f - (half_ulp >> (f == implicit_bit && e > min_normal_e)), e); + lower = fp(f - (half_ulp >> ((f == implicit_bit && e > min_normal_e) ? 1 : 0)), e); lower.f <<= lower.e - upper.e; lower.e = upper.e; } diff --git a/include/fmt/format.h b/include/fmt/format.h index 9ca0be18..5ff4c86f 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2805,7 +2805,7 @@ void internal::basic_writer::write_fp(T value, int precision = specs.precision >= 0 || !specs.type ? specs.precision : 6; unsigned options = 0; if (handler.fixed) options |= grisu_options::fixed; - if (sizeof(value) == sizeof(float)) options |= grisu_options::binary32; + if constexpr (sizeof(value) == sizeof(float)) options |= grisu_options::binary32; bool use_grisu = USE_GRISU && (specs.type != 'a' && specs.type != 'A' && specs.type != 'e' &&