From 1d50f57dd969d1c8d2986859144c98dc1e6b2cfa Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Thu, 6 Feb 2025 00:16:28 -0500 Subject: [PATCH] better wording. --- include/fast_float/decimal_to_binary.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/fast_float/decimal_to_binary.h b/include/fast_float/decimal_to_binary.h index 4eefa95..9487682 100644 --- a/include/fast_float/decimal_to_binary.h +++ b/include/fast_float/decimal_to_binary.h @@ -93,8 +93,8 @@ compute_error(int64_t q, uint64_t w) noexcept { return compute_error_scaled(q, product.high, lz); } -// w * 10 ** q -// The returned value should be a valid ieee64 number that simply need to be +// Computers w * 10 ** q. +// The returned value should be a valid number that simply needs to be // packed. However, in some very rare cases, the computation will fail. In such // cases, we return an adjusted_mantissa with a negative power of 2: the caller // should recompute in such cases. @@ -158,7 +158,8 @@ compute_float(int64_t q, uint64_t w) noexcept { // next line is safe because -answer.power2 + 1 < 64 answer.mantissa >>= -answer.power2 + 1; // Thankfully, we can't have both "round-to-even" and subnormals because - // "round-to-even" only occurs for powers close to 0. + // "round-to-even" only occurs for powers close to 0 in the 32-bit and + // and 64-bit case (with no more than 19 digits). answer.mantissa += (answer.mantissa & 1); // round up answer.mantissa >>= 1; // There is a weird scenario where we don't have a subnormal but just.