Skip to content

Commit 5a27789

Browse files
committed
add optimization from fastfloat#402
1 parent 73f4d84 commit 5a27789

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

include/fast_float/digit_comparison.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,9 @@ parse_mantissa(bigint &result, const parsed_number_string_t<UC> &num) noexcept {
322322
add_native(result, static_cast<limb>(powers_of_ten_uint64[counter]),
323323
value);
324324
bool truncated = is_truncated(p, pend);
325-
if (num.fraction.ptr != nullptr) {
326-
truncated |= is_truncated(num.fraction);
325+
// A nonzero integer suffix already determines the rounding direction.
326+
if (!truncated && num.fraction.ptr != nullptr) {
327+
truncated = is_truncated(num.fraction);
327328
}
328329
if (truncated) {
329330
round_up_bigint(result, digits);

0 commit comments

Comments
 (0)