From 5a277895010cf8fb060d4fddf7daeafb53aa551b Mon Sep 17 00:00:00 2001 From: HedgehogInTheCPP Date: Tue, 25 Aug 2026 04:51:45 +0300 Subject: [PATCH] add optimization from https://github.com/fastfloat/fast_float/pull/402 --- include/fast_float/digit_comparison.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/fast_float/digit_comparison.h b/include/fast_float/digit_comparison.h index f9019b8..710aa6e 100644 --- a/include/fast_float/digit_comparison.h +++ b/include/fast_float/digit_comparison.h @@ -322,8 +322,9 @@ parse_mantissa(bigint &result, const parsed_number_string_t &num) noexcept { add_native(result, static_cast(powers_of_ten_uint64[counter]), value); bool truncated = is_truncated(p, pend); - if (num.fraction.ptr != nullptr) { - truncated |= is_truncated(num.fraction); + // A nonzero integer suffix already determines the rounding direction. + if (!truncated && num.fraction.ptr != nullptr) { + truncated = is_truncated(num.fraction); } if (truncated) { round_up_bigint(result, digits);