partial-min-max

Crates.iopartial-min-max
lib.rspartial-min-max
version0.4.0
sourcesrc
created_at2019-03-21 03:09:16.09451
updated_at2019-12-19 06:09:10.854412
description`min` and `max` functions that work with `PartialOrd`.
homepage
repositoryhttps://github.com/fitzgen/fart/tree/master/crates/partial-min-max
max_upload_size
id122849
size3,300
Nick Fitzgerald (fitzgen)

documentation

https://docs.rs/partial-min-max

README

partial-min-max

Provides min and max functions that work with PartialOrd.

use partial_min_max::{min, max};
use std::f32::NAN;

// Does what you expect for the easy cases...
assert_eq!(min(0.0, 1.0), 0.0);
assert_eq!(max(0.0, 1.0), 1.0);

// In the case of comparisons with NaN or other partial orderings, returns the
// second value.
assert!(min(0.0, NAN).is_nan());
assert_eq!(min(NAN, 0.0), 0.0);
Commit count: 393

cargo fmt