Skip to content

Commit 1a19f98

Browse files
committed
Comment how the significand limits lossless int->float conversion
1 parent 00d8d7b commit 1a19f98

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libcore/num/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1515,6 +1515,10 @@ impl_from! { u16, i32 }
15151515
impl_from! { u16, i64 }
15161516
impl_from! { u32, i64 }
15171517

1518+
// Note: integers can only be represented with full precision in a float if
1519+
// they fit in the significand, which is 24 bits in f32 and 53 bits in f64.
1520+
// Lossy float conversions are not implemented at this time.
1521+
15181522
// Signed -> Float
15191523
impl_from! { i8, f32 }
15201524
impl_from! { i8, f64 }

0 commit comments

Comments
 (0)