From: Michael Hudson-Doyle Date: Wed, 13 Mar 2019 02:55:30 +0000 (+1300) Subject: round result of (highest as f64).log(2.0) X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c9349f266c3cc4cbf3e1390000d28e84c57825bb;p=cargo.git round result of (highest as f64).log(2.0) Even though (1024f64).log(2.0) has an exact, representable, value, with rustc 1.32 on i386 it comes out as +9.999999999999999985 with optimization enabled. And the rustc doesn't like having two defintions for U1024 etc. Gbp-Pq: Name 1001_typenum_pr_115.patch --- diff --git a/vendor/typenum/build/main.rs b/vendor/typenum/build/main.rs index 9c9f237cd..153031a2f 100644 --- a/vendor/typenum/build/main.rs +++ b/vendor/typenum/build/main.rs @@ -77,7 +77,7 @@ pub fn no_std() {} fn main() { let highest: u64 = 1024; - let first2: u32 = (highest as f64).log(2.0) as u32 + 1; + let first2: u32 = (highest as f64).log(2.0).round() as u32 + 1; let first10: u32 = (highest as f64).log(10.0) as u32 + 1; let uints = (0..(highest + 1)) .chain((first2..64).map(|i| 2u64.pow(i)))