diff options
author | sanine <sanine.not@pm.me> | 2022-11-25 01:45:19 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-11-25 01:45:19 -0600 |
commit | e16b477baa9c8ce3ae6757417620ef4a7d2d46ba (patch) | |
tree | c0bc8d73522df9e526cb8bdb10150a74d11bd795 /lily-test.c | |
parent | 0b23c4f4ed105790a5c87262dc6b523d30e8f052 (diff) |
fix absolute value bug
Diffstat (limited to 'lily-test.c')
-rw-r--r-- | lily-test.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lily-test.c b/lily-test.c index 20728fe..50e369f 100644 --- a/lily-test.c +++ b/lily-test.c @@ -47,6 +47,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <math.h> #include "lily-test.h" struct lily_globals_t _lily_globals = { {0}, 0, NULL, "" }; @@ -209,7 +210,7 @@ void _lily_assert_int_not_equal(const char *name_a, const char *name_b, void _lily_assert_float_equal(const char *name_a, const char *name_b, double a, double b, double epsilon, const char *location) { - lily_assert_msg(abs(a - b) <= epsilon, + lily_assert_msg(fabs(a - b) <= epsilon, "%s (%f) is not equal to %s (%f) (epsilon: %f)", name_a, a, name_b, b, epsilon); } @@ -218,7 +219,7 @@ void _lily_assert_float_equal(const char *name_a, const char *name_b, void _lily_assert_float_not_equal(const char *name_a, const char *name_b, double a, double b, double epsilon, const char *location) { - lily_assert_msg(abs(a - b) > epsilon, + lily_assert_msg(fabs(a - b) > epsilon, "%s (%f) is equal to %s (%f) (epsilon: %f)", name_a, a, name_b, b, epsilon); } |