summaryrefslogtreecommitdiffstats
path: root/test/test_helpers.h
diff options
context:
space:
mode:
authorIlya Tumaykin <itumaykin@gmail.com>2018-02-01 14:05:06 +0300
committerKevin Mitchell <kevmitch@gmail.com>2018-02-03 13:56:08 -0800
commitf4f24c105f9c132e84cba9a9707acc261033a816 (patch)
tree6a0b1ffbd5a16acdbcfa70ee80aaecd527b0d765 /test/test_helpers.h
parentd7db42d27f0a474a0ef0de8a771d3e4d5344e3ed (diff)
downloadmpv-f4f24c105f9c132e84cba9a9707acc261033a816.tar.bz2
mpv-f4f24c105f9c132e84cba9a9707acc261033a816.tar.xz
tests: stop comparing floats against DBL_EPSILON, use FLT_EPSILON
Fixes #5253.
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