pub struct FiniteF64(/* private fields */);Expand description
A finite 64-bit floating point type.
This is a restricted version of f64 that does not allow NaN or infinity.
Implementations§
Source§impl FiniteF64
impl FiniteF64
Sourcepub const unsafe fn new_unchecked(value: f64) -> Self
pub const unsafe fn new_unchecked(value: f64) -> Self
Creates a finite float without checking whether the value is finite. This results in undefined behavior if the value is non-finite.
§Safety
The value must not be NaN or infinite.
Sourcepub fn cast_from_u64(value: u64) -> Self
pub fn cast_from_u64(value: u64) -> Self
Creates a FiniteF64 from a u64 by casting the value to a float.
The cast is guaranteed to be finite but may not be accurate.
See also: <doc.rust-lang.org/reference/expressions/operator-expr.html#r-expr.as.numeric.int-as-float>
Sourcepub fn saturating_add(self, other: Self) -> Self
pub fn saturating_add(self, other: Self) -> Self
Adds two numbers, saturating at the maximum and minimum representable values.
Sourcepub fn saturating_sub(self, other: Self) -> Self
pub fn saturating_sub(self, other: Self) -> Self
Subtracts two numbers, saturating at the maximum and minimum representable values.
Sourcepub fn saturating_mul(self, other: Self) -> Self
pub fn saturating_mul(self, other: Self) -> Self
Multiplies two numbers, saturating at the maximum and minimum representable values.
Sourcepub fn saturating_div(self, other: Self) -> Self
pub fn saturating_div(self, other: Self) -> Self
Divides two numbers, saturating at the maximum and minimum representable values.
Trait Implementations§
Source§impl AddAssign for FiniteF64
impl AddAssign for FiniteF64
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read more