This commit is contained in:
David Tolnay
2019-06-11 14:09:45 -07:00
parent ac5ad59745
commit 27bc768d19
2 changed files with 5 additions and 6 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ C, [https://github.com/ulfjack/ryu][upstream].
uses nothing from the Rust standard library so is usable from no_std crates.*
[paper]: https://dl.acm.org/citation.cfm?id=3192369
[upstream]: https://github.com/ulfjack/ryu/tree/159ce150fa94e0229f3e02ecc6f4243f21388c0b
[upstream]: https://github.com/ulfjack/ryu/tree/688f43b62276b400728baad54afc32c3ab9c1a95
```toml
[dependencies]
+4 -5
View File
@@ -258,11 +258,10 @@ pub fn d2d(ieee_mantissa: u64, ieee_exponent: u32) -> FloatingDecimal64 {
}
} else if q < 63 {
// TODO(ulfjack): Use a tighter bound here.
// We need to compute min(ntz(mv), pow5_factor(mv) - e2) >= q - 1
// <=> ntz(mv) >= q - 1 && pow5_factor(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)
vr_is_trailing_zeros = multiple_of_power_of_2(mv, q);
}
}