From 7faf830f2e4d828996426ea5fe630cb6ccd494bb Mon Sep 17 00:00:00 2001 From: Amy Retzerau Date: Sat, 22 Nov 2025 11:58:05 +0100 Subject: [PATCH] feat: improved small num test --- fastmath.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fastmath.hpp b/fastmath.hpp index f4f2342..f58fa6c 100644 --- a/fastmath.hpp +++ b/fastmath.hpp @@ -81,6 +81,7 @@ struct decimal { decimal sqrt() { return {((int32_t)sqrtf(i)) << HALF_SHIFT}; } float to_float() { return TO_FLOAT(i); } + bool isSmall() { return (abs(i) < (1 << (HALF_SHIFT - 1))); } }; template struct vec { @@ -164,7 +165,7 @@ template struct vec { } bool isSmall() { for (int i = 0; i < n; i++) { - if (abs(v[i].i) > (1 << (HALF_SHIFT - 1))) + if (!v[i].isSmall()) return false; } return true;