diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 9912dc1c..eba27f46 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -2049,15 +2049,15 @@ template decimal_fp to_decimal(T x) noexcept { uint32_t r = static_cast(z_mul.result - float_info::big_divisor * ret_value.significand); - if (r > deltai) { - goto small_divisor_case_label; - } else if (r < deltai) { + if (r < deltai) { // Exclude the right endpoint if necessary. if (r == 0 && z_mul.is_integer && !include_right_endpoint) { --ret_value.significand; r = float_info::big_divisor; goto small_divisor_case_label; } + } else if (r > deltai) { + goto small_divisor_case_label; } else { // r == deltai; compare fractional parts. const carrier_uint two_fl = two_fc - 1;