Use f32::to_bits and f64::to_bits
This commit is contained in:
committed by
Benjamin Bouvier
parent
178241625c
commit
26accbadf8
@@ -809,7 +809,7 @@ impl Ieee32 {
|
|||||||
|
|
||||||
/// Create a new `Ieee32` representing the number `x`.
|
/// Create a new `Ieee32` representing the number `x`.
|
||||||
pub fn with_float(x: f32) -> Self {
|
pub fn with_float(x: f32) -> Self {
|
||||||
Ieee32(unsafe { mem::transmute(x) })
|
Ieee32(x.to_bits())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the bitwise representation.
|
/// Get the bitwise representation.
|
||||||
@@ -882,7 +882,7 @@ impl Ieee64 {
|
|||||||
|
|
||||||
/// Create a new `Ieee64` representing the number `x`.
|
/// Create a new `Ieee64` representing the number `x`.
|
||||||
pub fn with_float(x: f64) -> Self {
|
pub fn with_float(x: f64) -> Self {
|
||||||
Ieee64(unsafe { mem::transmute(x) })
|
Ieee64(x.to_bits())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the bitwise representation.
|
/// Get the bitwise representation.
|
||||||
|
|||||||
Reference in New Issue
Block a user