max

Function max 

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

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

If a > b return a, otherwise return b.

ยงExample

use partial_min_max::max;
use std::f32::NAN;

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

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