Skip to content

Commit 1ba0d48

Browse files
committed
* try to fix precision error on x86 platform step7.
1 parent df6b574 commit 1ba0d48

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/fast_float/decimal_to_binary.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +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-
limb_t upperbit = limb_t(product.high >> 63);
143-
limb_t shift = limb_t(upperbit + 64 - binary::mantissa_explicit_bits() - 3);
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);
144145

145146
answer.mantissa = product.high >> shift;
146147

include/fast_float/float_common.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +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 int16_t am_pow_t; // can't be int_fast16_t because invalid_am_bias
450-
// hacks. Needs rewriting this.
449+
typedef int32_t am_pow_t;
451450

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

0 commit comments

Comments
 (0)