From e5fda9cb25a6f6d792559238ed88c44d48593a58 Mon Sep 17 00:00:00 2001 From: gered Date: Mon, 3 Apr 2023 13:50:41 -0400 Subject: [PATCH] small enhancement to nearly_equal --- ggdt/src/math/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ggdt/src/math/mod.rs b/ggdt/src/math/mod.rs index ab49f55..ea61042 100644 --- a/ggdt/src/math/mod.rs +++ b/ggdt/src/math/mod.rs @@ -40,8 +40,8 @@ pub const RIGHT: f32 = RADIANS_0; /// precision of the provided epsilon value. #[inline] pub fn nearly_equal(a: f32, b: f32, epsilon: f32) -> bool { - // HACK/TODO: this is a shitty way to do this. but it's "good enough" for me ... - (a - b).abs() <= epsilon + // this could still be improved + a == b || (a - b).abs() <= epsilon } /// Linearly interpolates between two values.