From f3c84ccf75a4955d0927f9d86a9c26a840f83add Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 15 Feb 2014 18:15:22 -0800 Subject: Math is hard. Let's go shopping. Alternatively, we could use fabs() to determine the absolute value of floating point arguments. The author of commit b6a30dcdd3225 ("Improve floating point equality test") clearly has a rather loose definition of "improve". And the maintainer who accepted that patch shares the blame... Signed-off-by: Dirk Hohndel --- dive.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dive.h b/dive.h index fcb0727df..2e0039f80 100644 --- a/dive.h +++ b/dive.h @@ -21,7 +21,7 @@ (void) (&_max1 == &_max2); \ _max1 > _max2 ? _max1 : _max2; }) -#define IS_FP_SAME(_a,_b) (abs((_a) - (_b)) < 0.000001 * MAX(abs(_a), abs(_b))) +#define IS_FP_SAME(_a,_b) (fabs((_a) - (_b)) < 0.000001 * MAX(fabs(_a), fabs(_b))) #include #include -- cgit v1.2.3-70-g09d2