better wording.

This commit is contained in:
Daniel Lemire 2025-02-06 00:16:28 -05:00
parent 3a74bfb500
commit 1d50f57dd9

View File

@ -93,8 +93,8 @@ compute_error(int64_t q, uint64_t w) noexcept {
return compute_error_scaled<binary>(q, product.high, lz); return compute_error_scaled<binary>(q, product.high, lz);
} }
// w * 10 ** q // Computers w * 10 ** q.
// The returned value should be a valid ieee64 number that simply need to be // 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 // 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 // cases, we return an adjusted_mantissa with a negative power of 2: the caller
// should recompute in such cases. // 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 // next line is safe because -answer.power2 + 1 < 64
answer.mantissa >>= -answer.power2 + 1; answer.mantissa >>= -answer.power2 + 1;
// Thankfully, we can't have both "round-to-even" and subnormals because // 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 += (answer.mantissa & 1); // round up
answer.mantissa >>= 1; answer.mantissa >>= 1;
// There is a weird scenario where we don't have a subnormal but just. // There is a weird scenario where we don't have a subnormal but just.