Use f32::to_bits and f64::to_bits

This commit is contained in:
Anthony Ramine
2019-09-19 12:24:39 +02:00
committed by Benjamin Bouvier
parent 178241625c
commit 26accbadf8

View File

@@ -809,7 +809,7 @@ impl Ieee32 {
/// Create a new `Ieee32` representing the number `x`.
pub fn with_float(x: f32) -> Self {
Ieee32(unsafe { mem::transmute(x) })
Ieee32(x.to_bits())
}
/// Get the bitwise representation.
@@ -882,7 +882,7 @@ impl Ieee64 {
/// Create a new `Ieee64` representing the number `x`.
pub fn with_float(x: f64) -> Self {
Ieee64(unsafe { mem::transmute(x) })
Ieee64(x.to_bits())
}
/// Get the bitwise representation.