summaryrefslogtreecommitdiffstats
path: root/test/test_helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_helpers.h')
-rw-r--r--test/test_helpers.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/test_helpers.h b/test/test_helpers.h
index 7a61da82ea..49328f623f 100644
--- a/test/test_helpers.h
+++ b/test/test_helpers.h
@@ -10,6 +10,7 @@
#include <math.h>
#include <float.h>
-#define assert_double_equal(a, b) assert_true(fabs(a - b) <= DBL_EPSILON)
+#define assert_double_equal(a, b) assert_true(fabs((a) - (b)) <= DBL_EPSILON * fmax(fabs(a), fabs(b)))
+#define assert_float_equal(a, b) assert_true(fabsf((a) - (b)) <= FLT_EPSILON * fmaxf(fabsf(a), fabsf(b)))
#endif