]> git.lizzy.rs Git - rust.git/commitdiff
Comment how the significand limits lossless int->float conversion
authorJosh Stone <cuviper@gmail.com>
Wed, 28 Oct 2015 23:05:51 +0000 (16:05 -0700)
committerJosh Stone <cuviper@gmail.com>
Wed, 28 Oct 2015 23:05:51 +0000 (16:05 -0700)
src/libcore/num/mod.rs

index 38ad19c3cbe132208542e2fdebd157e23558aa5f..a79bdd5961e967e604f8ef48c8cb156970df7501 100644 (file)
@@ -1515,6 +1515,10 @@ fn from(small: $Small) -> $Large {
 impl_from! { u16, i64 }
 impl_from! { u32, i64 }
 
+// Note: integers can only be represented with full precision in a float if
+// they fit in the significand, which is 24 bits in f32 and 53 bits in f64.
+// Lossy float conversions are not implemented at this time.
+
 // Signed -> Float
 impl_from! { i8, f32 }
 impl_from! { i8, f64 }