From a3643e4cca8fe608ebd29468465fc3cc19d45638 Mon Sep 17 00:00:00 2001 From: Brett Date: Tue, 14 Mar 2023 17:30:22 -0400 Subject: [PATCH] f_equal --- include/blt/math/math.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/blt/math/math.h b/include/blt/math/math.h index df6ae91..58abd31 100644 --- a/include/blt/math/math.h +++ b/include/blt/math/math.h @@ -11,7 +11,13 @@ #include namespace blt { - + + constexpr float EPSILON = 0.0001f; + + static inline constexpr bool f_equal(float v1, float v2) { + return v1 >= v2 - EPSILON && v1 <= v2 + EPSILON; + } + /** * fast number integer */