0.1.7 |
|
---|---|
0.1.6 |
|
#25 in #cmp
4KB
cmp_floats
This is a function I made, because other float comparison libraries seemed unnecessarily complicated.
Examples
use std::cmp::Ordering::*;
use cmp_floats::cmp_floats;
assert_eq!(Less, cmp_floats(2.71828f32, 3.14159f64));
let a: f32 = 0.15 + 0.15 + 0.15;
let b: f32 = 0.1 + 0.1 + 0.25;
assert_eq!(Equal, cmp_floats(a, b));