From 96e81d23c69938a5ab7d67b5cf6f09153e7ca747 Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Fri, 31 Jul 2020 14:58:21 +0100 Subject: [PATCH] fixup for near-equality test --- TestFramework/Testing.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TestFramework/Testing.h b/TestFramework/Testing.h index 42f341cf..9202d7ce 100644 --- a/TestFramework/Testing.h +++ b/TestFramework/Testing.h @@ -564,7 +564,8 @@ static void testStart() /* some good macros to compare floating point numbers */ #import #import -#define EQ(x, y) (fabs((x) - (y)) <= fabs((x) + (y)) * (FLT_EPSILON * 100)) +#define EQ(x, y) \ + (((x) >= ((y) - FLT_EPSILON*100)) && ((x) <= ((y) + FLT_EPSILON*100))) #define LE(x, y) ((x)<(y) || EQ(x, y)) #define GE(x, y) ((y)<(x) || EQ(x, y)) #define LT(x, y) (!GE(x, y))