Skip to content

Commit

Permalink
Update comment
Browse files Browse the repository at this point in the history
Progress on #117.
  • Loading branch information
ulfjack committed Jun 6, 2019
1 parent 159ce15 commit 688f43b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ryu/d2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,10 @@ static inline floating_decimal_64 d2d(const uint64_t ieeeMantissa, const uint32_
--vp;
}
} else if (q < 63) { // TODO(ulfjack): Use a tighter bound here.
// We need to compute min(ntz(mv), pow5Factor(mv) - e2) >= q - 1
// <=> ntz(mv) >= q - 1 && pow5Factor(mv) - e2 >= q - 1
// <=> ntz(mv) >= q - 1 (e2 is negative and -e2 >= q)
// <=> (mv & ((1 << (q - 1)) - 1)) == 0
// We also need to make sure that the left shift does not overflow.
// We want to know if the full product has at least q trailing zeros.
// We need to compute min(p2(mv), p5(mv) - e2) >= q
// <=> p2(mv) >= q && p5(mv) - e2 >= q
// <=> p2(mv) >= q (because -e2 >= q)
vrIsTrailingZeros = multipleOfPowerOf2(mv, q);
#ifdef RYU_DEBUG
printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false");
Expand Down

0 comments on commit 688f43b

Please sign in to comment.