Crates.io | totally-ordered |
lib.rs | totally-ordered |
version | 0.2.0 |
source | src |
created_at | 2020-02-04 22:32:01.68373 |
updated_at | 2021-12-04 22:12:04.630567 |
description | No dependency, no-std totally ordered f32/f64 |
homepage | |
repository | https://github.com/l0calh05t/totally-ordered-rs.git |
max_upload_size | |
id | 204991 |
size | 18,042 |
This crate adds the TotallyOrderable
trait for f32
and f64
values as well as the ABI-transparent TotallyOrdered
type which adds Ord + Eq + Hash
to wrapped floating point values.
Main use case: sorting of floating-point arrays which may or may not contain not-a-numbers, infinities, and positive or negative zeros.
use totally_ordered::TotallyOrdered;
let mut values : [f64; 4] = [-0.0, 0.0, -1.0, 1.0];
TotallyOrdered::new_slice_mut(&mut values).sort();