chiark / gitweb /
test-json: use fabs
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Tue, 16 Dec 2014 19:36:40 +0000 (20:36 +0100)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Tue, 16 Dec 2014 19:38:03 +0000 (20:38 +0100)
src/test/test-json.c

index 8777cf7a401d060837a0976edd19ac4bd52e8ed1..00768358bf4469105b7ee05e43b2f0c6a3c51559 100644 (file)
@@ -19,6 +19,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#include <math.h>
+
 #include "log.h"
 #include "util.h"
 #include "json.h"
@@ -52,7 +54,7 @@ static void test_one(const char *data, ...) {
                         double d;
 
                         d = va_arg(ap, double);
-                        assert_se(abs(d - v.real) < 0.001);
+                        assert_se(fabs(d - v.real) < 0.001);
 
                 } else if (t == JSON_INTEGER) {
                         intmax_t i;