1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
From: Dima Kogan <dkogan@debian.org>
Date: Mon, 25 May 2020 21:06:35 -0700
Subject: Fixed test failure comparing floating-point numbers
This was only an issue on i386. Closes: #943512
---
libtu/test/tutest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libtu/test/tutest.c b/libtu/test/tutest.c
index 4d8d7a4..2161cf7 100644
--- a/libtu/test/tutest.c
+++ b/libtu/test/tutest.c
@@ -8,6 +8,7 @@
*/
#include <stdio.h>
+#include <math.h>
#include "../misc.h"
#include "../tokenizer.h"
@@ -39,7 +40,7 @@ int test_get_token() {
return 31;
if (tok.type != TOK_DOUBLE)
return 32;
- if (TOK_DOUBLE_VAL(&tok) != 2.3){
+ if (fabs(TOK_DOUBLE_VAL(&tok) - 2.3) > 1e-6){
fprintf(stderr, "Expected 2.3, got %f\n", TOK_DOUBLE_VAL(&tok));
return 33;
}
|