mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-06 08:46:49 +08:00
* try to fix precision error on x86 platform step9.
This commit is contained in:
parent
97aa629922
commit
3e498bb3b1
@ -439,7 +439,7 @@ parse_number_string(UC const *p, UC const *pend,
|
||||
} else {
|
||||
// Now let's parse the explicit exponent.
|
||||
while ((p != pend) && is_integer(*p)) {
|
||||
if (exp_number < 0x10000000) {
|
||||
if (exp_number < 0x10000) {
|
||||
// check for exponent overflow if we have too many digits.
|
||||
UC const digit = UC(*p - UC('0'));
|
||||
exp_number = 10 * exp_number + static_cast<am_pow_t>(digit);
|
||||
|
||||
@ -139,9 +139,9 @@ compute_float(int64_t q, uint64_t w) noexcept {
|
||||
// branchless approach: value128 product = compute_product(q, w); but in
|
||||
// practice, we can win big with the compute_product_approximation if its
|
||||
// additional branch is easily predicted. Which is best is data specific.
|
||||
am_pow_t const upperbit = am_pow_t(product.high >> 63);
|
||||
am_pow_t const shift =
|
||||
am_pow_t(upperbit + 64 - binary::mantissa_explicit_bits() - 3);
|
||||
limb_t const upperbit = limb_t(product.high >> 63);
|
||||
limb_t const shift =
|
||||
limb_t(upperbit + 64 - binary::mantissa_explicit_bits() - 3);
|
||||
|
||||
answer.mantissa = product.high >> shift;
|
||||
|
||||
|
||||
@ -446,7 +446,7 @@ typedef int_fast8_t am_bits_t;
|
||||
|
||||
// Power bias is signed for handling a denormal float
|
||||
// or an invalid mantissa.
|
||||
typedef int_fast32_t am_pow_t;
|
||||
typedef int_fast16_t am_pow_t;
|
||||
|
||||
// Bias so we can get the real exponent with an invalid adjusted_mantissa.
|
||||
constexpr static am_pow_t invalid_am_bias = -0x8000;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user