summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2007-10-20 14:34:54 +0200
committerBruno Haible <bruno@clisp.org>2007-10-20 14:34:54 +0200
commitc532b2a8ef48d317a1bc348584c00880ea7c5ba6 (patch)
tree3211dfaabd3df0a8d5710606512073e7ecd05f40 /tests
parentcf3719f4dcf54ebc3ef884a74c7ed9f80fc2912c (diff)
downloadgnulib-c532b2a8ef48d317a1bc348584c00880ea7c5ba6.tar.gz
Don't rely on excess precision: -4 > -3.00000024 - 1 can evaluate to false
if the CPU rounds correctly to nearest.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-ceilf2.c2
-rw-r--r--tests/test-floorf2.c2
-rw-r--r--tests/test-trunc2.c4
-rw-r--r--tests/test-truncf2.c4
4 files changed, 6 insertions, 6 deletions
diff --git a/tests/test-ceilf2.c b/tests/test-ceilf2.c
index 7d3c42ff4c..f5e886b66a 100644
--- a/tests/test-ceilf2.c
+++ b/tests/test-ceilf2.c
@@ -112,7 +112,7 @@ correct_result_p (DOUBLE x, DOUBLE result)
{
return
(x > 0 && x <= 1 ? result == L_(1.0) :
- x + 1 > x ? result >= x && result < x + 1 :
+ x + 1 > x ? result >= x && result <= x + 1 && result - x < 1 :
equal (result, x));
}
diff --git a/tests/test-floorf2.c b/tests/test-floorf2.c
index 5d87866449..c79091fec7 100644
--- a/tests/test-floorf2.c
+++ b/tests/test-floorf2.c
@@ -112,7 +112,7 @@ correct_result_p (DOUBLE x, DOUBLE result)
{
return
(x < 0 && x >= -1 ? result == - L_(1.0) :
- x - 1 < x ? result <= x && result > x - 1 :
+ x - 1 < x ? result <= x && result >= x - 1 && x - result < 1 :
equal (result, x));
}
diff --git a/tests/test-trunc2.c b/tests/test-trunc2.c
index 5292ff64ff..f3238ffe2c 100644
--- a/tests/test-trunc2.c
+++ b/tests/test-trunc2.c
@@ -113,10 +113,10 @@ correct_result_p (DOUBLE x, DOUBLE result)
return
(x >= 0
? (x < 1 ? result == L_(0.0) :
- x - 1 < x ? result <= x && result > x - 1 :
+ x - 1 < x ? result <= x && result >= x - 1 && x - result < 1 :
equal (result, x))
: (x > -1 ? result == L_(0.0) :
- x + 1 > x ? result >= x && result < x + 1 :
+ x + 1 > x ? result >= x && result <= x + 1 && result - x < 1 :
equal (result, x)));
}
diff --git a/tests/test-truncf2.c b/tests/test-truncf2.c
index c511cb1ebf..a0b7e6c794 100644
--- a/tests/test-truncf2.c
+++ b/tests/test-truncf2.c
@@ -113,10 +113,10 @@ correct_result_p (DOUBLE x, DOUBLE result)
return
(x >= 0
? (x < 1 ? result == L_(0.0) :
- x - 1 < x ? result <= x && result > x - 1 :
+ x - 1 < x ? result <= x && result >= x - 1 && x - result < 1 :
equal (result, x))
: (x > -1 ? result == L_(0.0) :
- x + 1 > x ? result >= x && result < x + 1 :
+ x + 1 > x ? result >= x && result <= x + 1 && result - x < 1 :
equal (result, x)));
}