Function min

Source
pub fn min<T>(a: T, b: T) -> T
where T: PartialOrd,
Expand description

A version of std::cmp::min that works with PartialOrd types.

If a < b return a, otherwise return b.

ยงExample

use partial_min_max::min;
use std::f32::NAN;

assert_eq!(min(0.0, 1.0), 0.0);

assert!(min(0.0, NAN).is_nan());
assert_eq!(min(NAN, 0.0), 0.0);