Fixed the test to not use an epsilon

This commit is contained in:
Micha White 2022-05-22 17:21:04 -04:00
parent d8a281ef73
commit 4de301e394
No known key found for this signature in database
GPG key ID: AED94BFA1C301389
3 changed files with 3 additions and 1 deletions

View file

@ -42,7 +42,7 @@ fn is_useless_rounding(expr: &Expr) -> Option<(&str, String)> {
} else { } else {
"" ""
}; };
if f.fract() < f64::EPSILON { if f.fract() == 0.0 {
Some((method_name, f_str)) Some((method_name, f_str))
} else { } else {
None None

View file

@ -5,4 +5,5 @@ fn main() {
let _ = 1f32; let _ = 1f32;
let _ = 1.0f64; let _ = 1.0f64;
let _ = 1.00f32; let _ = 1.00f32;
let _ = 2e-54f64.floor();
} }

View file

@ -5,4 +5,5 @@ fn main() {
let _ = 1f32.ceil(); let _ = 1f32.ceil();
let _ = 1.0f64.floor(); let _ = 1.0f64.floor();
let _ = 1.00f32.round(); let _ = 1.00f32.round();
let _ = 2e-54f64.floor();
} }