summaryrefslogtreecommitdiff
path: root/core/math/math_funcs.h
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2020-03-29 05:33:03 -0400
committerAaron Franke <arnfranke@yahoo.com>2020-09-23 00:28:49 -0400
commit9394c057b871d1e52ae8995a56948dfae0f5583e (patch)
treea7819b853dca4159563ee92c78024ae1ff263160 /core/math/math_funcs.h
parent23dabcd2d063468b32233c8f3e0c130ce75f7403 (diff)
Remove redundant is_equal_approx_ratio method
is_equal_approx is able to handle values of any size, and is_equal_approx_ratio is no longer used in any exposed APIs, so we don't need is_equal_approx_ratio anymore. Also, add #ifdef MATH_CHECKS for a method that is only used when MATH_CHECKS is defined.
Diffstat (limited to 'core/math/math_funcs.h')
-rw-r--r--core/math/math_funcs.h12
1 files changed, 0 insertions, 12 deletions
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index 24b42790f0..f83ee44f4a 100644
--- a/core/math/math_funcs.h
+++ b/core/math/math_funcs.h
@@ -291,18 +291,6 @@ public:
static float random(float from, float to);
static real_t random(int from, int to) { return (real_t)random((real_t)from, (real_t)to); }
- static _ALWAYS_INLINE_ bool is_equal_approx_ratio(real_t a, real_t b, real_t epsilon = CMP_EPSILON, real_t min_epsilon = CMP_EPSILON) {
- // this is an approximate way to check that numbers are close, as a ratio of their average size
- // helps compare approximate numbers that may be very big or very small
- real_t diff = abs(a - b);
- if (diff == 0.0 || diff < min_epsilon) {
- return true;
- }
- real_t avg_size = (abs(a) + abs(b)) / 2.0;
- diff /= avg_size;
- return diff < epsilon;
- }
-
static _ALWAYS_INLINE_ bool is_equal_approx(real_t a, real_t b) {
// Check for exact equality first, required to handle "infinity" values.
if (a == b) {