Skip to content

Commit 3e498bb

Browse files
committed
* try to fix precision error on x86 platform step9.
1 parent 97aa629 commit 3e498bb

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

include/fast_float/ascii_number.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ parse_number_string(UC const *p, UC const *pend,
439439
} else {
440440
// Now let's parse the explicit exponent.
441441
while ((p != pend) && is_integer(*p)) {
442-
if (exp_number < 0x10000000) {
442+
if (exp_number < 0x10000) {
443443
// check for exponent overflow if we have too many digits.
444444
UC const digit = UC(*p - UC('0'));
445445
exp_number = 10 * exp_number + static_cast<am_pow_t>(digit);

include/fast_float/decimal_to_binary.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ compute_float(int64_t q, uint64_t w) noexcept {
139139
// branchless approach: value128 product = compute_product(q, w); but in
140140
// practice, we can win big with the compute_product_approximation if its
141141
// additional branch is easily predicted. Which is best is data specific.
142-
am_pow_t const upperbit = am_pow_t(product.high >> 63);
143-
am_pow_t const shift =
144-
am_pow_t(upperbit + 64 - binary::mantissa_explicit_bits() - 3);
142+
limb_t const upperbit = limb_t(product.high >> 63);
143+
limb_t const shift =
144+
limb_t(upperbit + 64 - binary::mantissa_explicit_bits() - 3);
145145

146146
answer.mantissa = product.high >> shift;
147147

include/fast_float/float_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ typedef int_fast8_t am_bits_t;
446446

447447
// Power bias is signed for handling a denormal float
448448
// or an invalid mantissa.
449-
typedef int_fast32_t am_pow_t;
449+
typedef int_fast16_t am_pow_t;
450450

451451
// Bias so we can get the real exponent with an invalid adjusted_mantissa.
452452
constexpr static am_pow_t invalid_am_bias = -0x8000;

0 commit comments

Comments
 (0)