| Crates.io | partial-min-max |
| lib.rs | partial-min-max |
| version | 0.4.0 |
| created_at | 2019-03-21 03:09:16.09451+00 |
| updated_at | 2019-12-19 06:09:10.854412+00 |
| description | `min` and `max` functions that work with `PartialOrd`. |
| homepage | |
| repository | https://github.com/fitzgen/fart/tree/master/crates/partial-min-max |
| max_upload_size | |
| id | 122849 |
| size | 3,300 |
partial-min-maxProvides 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);