Skip to content

Commit

Permalink
Comment how the significand limits lossless int->float conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Oct 28, 2015
1 parent 00d8d7b commit 1a19f98
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libcore/num/mod.rs
Expand Up @@ -1515,6 +1515,10 @@ impl_from! { u16, i32 }
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 }
Expand Down

0 comments on commit 1a19f98

Please sign in to comment.