[][src]Function min_max::max

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

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);