diff options
Diffstat (limited to 'ctr-std/src/f64.rs')
| -rw-r--r-- | ctr-std/src/f64.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ctr-std/src/f64.rs b/ctr-std/src/f64.rs index e4eea74..6f34f17 100644 --- a/ctr-std/src/f64.rs +++ b/ctr-std/src/f64.rs @@ -970,7 +970,7 @@ impl f64 { #[stable(feature = "float_bits_conv", since = "1.20.0")] #[inline] pub fn to_bits(self) -> u64 { - unsafe { ::mem::transmute(self) } + num::Float::to_bits(self) } /// Raw transmutation from `u64`. @@ -978,7 +978,7 @@ impl f64 { /// This is currently identical to `transmute::<u64, f64>(v)` on all platforms. /// It turns out this is incredibly portable, for two reasons: /// - /// * Floats and Ints have the same endianess on all supported platforms. + /// * Floats and Ints have the same endianness on all supported platforms. /// * IEEE-754 very precisely specifies the bit layout of floats. /// /// However there is one caveat: prior to the 2008 version of IEEE-754, how @@ -1014,8 +1014,7 @@ impl f64 { #[stable(feature = "float_bits_conv", since = "1.20.0")] #[inline] pub fn from_bits(v: u64) -> Self { - // It turns out the safety issues with sNaN were overblown! Hooray! - unsafe { ::mem::transmute(v) } + num::Float::from_bits(v) } } |