Skip to main content

min

Function min 

Source
pub fn min<T: AsRef<[f64]>>(values: T) -> f64
Expand description

Calculate statistical min for values.

§Nan

Return NaN if the values are empty.

From https://doc.rust-lang.org/std/primitive.f64.html#method.max:

If one of the arguments is NaN, then the other argument is returned. This follows the IEEE 754-2008 semantics for minNum, except for handling of signaling NaNs; this function handles all NaNs the same way and avoids minNum’s problems with associativity. This also matches the behavior of libm’s fmin. In particular, if the inputs compare equal (such as for the case of +0.0 and -0.0), either input may be returned non-deterministically.

§Example

#[macro_use]
use numeric_statistics::f64::min::*;
let values = &[1.0, 2.0, 4.0];
let min = min(values);
assert_eq!(min, 1.0);