From 8618c86421b3cf6afccf420e90d8023f8af89c60 Mon Sep 17 00:00:00 2001 From: David Peter Date: Tue, 24 Aug 2021 21:50:31 +0200 Subject: [PATCH] Fix float eq check --- src/internal.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/internal.rs b/src/internal.rs index 1d7f14b..9e9c2e1 100644 --- a/src/internal.rs +++ b/src/internal.rs @@ -137,8 +137,8 @@ pub fn write_benchmark_comparison(results: &[BenchmarkResult]) { #[test] fn test_max() { - let assert_float_eq = |a, b| { - assert!((a - b) < f64::EPSILON); + let assert_float_eq = |a: f64, b: f64| { + assert!((a - b).abs() < f64::EPSILON); }; assert_float_eq(1.0, max(&[1.0]));