fixup for near-equality test

This commit is contained in:
Richard Frith-Macdonald 2020-07-31 14:58:21 +01:00
parent 2e41a77191
commit 96e81d23c6

View file

@ -564,7 +564,8 @@ static void testStart()
/* some good macros to compare floating point numbers */
#import <math.h>
#import <float.h>
#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))