impl Ieee64::from(f64) and Ieee32::from(f32)
This commit is contained in:
@@ -665,6 +665,12 @@ impl FromStr for Ieee32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<f32> for Ieee32 {
|
||||||
|
fn from(x: f32) -> Self {
|
||||||
|
Ieee32::with_float(x)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Ieee64 {
|
impl Ieee64 {
|
||||||
/// Create a new `Ieee64` containing the bits of `x`.
|
/// Create a new `Ieee64` containing the bits of `x`.
|
||||||
pub fn with_bits(x: u64) -> Self {
|
pub fn with_bits(x: u64) -> Self {
|
||||||
@@ -726,6 +732,12 @@ impl FromStr for Ieee64 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<f64> for Ieee64 {
|
||||||
|
fn from(x: f64) -> Self {
|
||||||
|
Ieee64::with_float(x)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|||||||
Reference in New Issue
Block a user