Trait typed_floats::Min
source · pub trait Min<T> {
type Output;
// Required method
fn min(self, rhs: T) -> Self::Output;
}
Expand description
This trait is used to specify the return type of the Min::min()
function.
Required Associated Types§
sourcetype Output
type Output
The resulting type after applying Min::min()
.
Required Methods§
sourcefn min(self, rhs: T) -> Self::Output
fn min(self, rhs: T) -> Self::Output
Returns the minimum of the two numbers.
This follows the IEEE 754-2008 semantics for minNum. This also matches the behavior of libm’s fmin.
The min of +0.0
and -0.0
may return either operand.
https://llvm.org/docs/LangRef.html#llvm-minnum-intrinsic
§Examples
let x: NonNaN = 3.0.try_into().unwrap();
let y: NonNaN = 4.0.try_into().unwrap();
assert_eq!(Min::min(x, y), 3.0);
See f64::min()
for more details.