From 284743c683aebae3277f64a07cdd0deedf629039 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Wed, 2 Apr 2025 18:33:47 -0400 Subject: [PATCH] add range to f_equal --- CMakeLists.txt | 2 +- include/blt/math/vectors.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index af6a982..cc07fd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 5.2.32) +set(BLT_VERSION 5.2.33) set(BLT_TARGET BLT) diff --git a/include/blt/math/vectors.h b/include/blt/math/vectors.h index 75820bb..81107db 100644 --- a/include/blt/math/vectors.h +++ b/include/blt/math/vectors.h @@ -21,9 +21,9 @@ namespace blt constexpr float EPSILON = std::numeric_limits::epsilon(); - static inline constexpr bool f_equal(float v1, float v2) + static constexpr bool f_equal(const float v1, const float v2, const float range = 1) { - return v1 >= v2 - EPSILON && v1 <= v2 + EPSILON; + return v1 >= v2 - (EPSILON * range) && v1 <= v2 + (EPSILON * range); } template