summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2008-08-12 22:30:29 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2008-08-12 22:30:29 +0000
commita7980a1e0998a77f024bf69c2c29f00653e6b58c (patch)
tree8e837f02106905f77aa7b696eb7a7f59a062dd41 /tests
parent53bf561c9df06062fa4a7fb5e0a793115649127a (diff)
downloadmpfr-a7980a1e0998a77f024bf69c2c29f00653e6b58c.tar.gz
tests/tdiv.c: completed underflow test by testing negative results too
(merged changeset 5519 from the trunk). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/2.3@5520 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r--tests/tdiv.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/tests/tdiv.c b/tests/tdiv.c
index f7f88ac10..33fd2399d 100644
--- a/tests/tdiv.c
+++ b/tests/tdiv.c
@@ -722,7 +722,9 @@ check_nan (void)
mpfr_set_prec (d, mpfr_get_prec (q) + 8);
for (i = -1; i <= 1; i++)
{
- /* Test 2^(-2) / (2 + eps), with eps < 0, eps = 0, eps > 0.
+ int sign;
+
+ /* Test 2^(-2) / (+/- (2 + eps)), with eps < 0, eps = 0, eps > 0.
-> underflow.
With div.c r5513, this test fails for eps > 0 in GMP_RNDN. */
mpfr_set_ui (d, 2, GMP_RNDZ);
@@ -730,17 +732,22 @@ check_nan (void)
mpfr_nextbelow (d);
if (i > 0)
mpfr_nextabove (d);
- mpfr_clear_flags ();
- test_div (q, a, d, GMP_RNDZ); /* result = 0 */
- MPFR_ASSERTN (mpfr_underflow_p ());
- MPFR_ASSERTN (MPFR_IS_ZERO (q) && MPFR_IS_POS (q));
- mpfr_clear_flags ();
- test_div (q, a, d, GMP_RNDN); /* result = 0 iff eps >= 0 */
- MPFR_ASSERTN (mpfr_underflow_p ());
- MPFR_ASSERTN (MPFR_IS_POS (q));
- if (i < 0)
- mpfr_nextbelow (q);
- MPFR_ASSERTN (MPFR_IS_ZERO (q));
+ for (sign = 0; sign <= 1; sign++)
+ {
+ mpfr_clear_flags ();
+ test_div (q, a, d, GMP_RNDZ); /* result = 0 */
+ MPFR_ASSERTN (mpfr_underflow_p ());
+ MPFR_ASSERTN (sign ? MPFR_IS_NEG (q) : MPFR_IS_POS (q));
+ MPFR_ASSERTN (MPFR_IS_ZERO (q));
+ mpfr_clear_flags ();
+ test_div (q, a, d, GMP_RNDN); /* result = 0 iff eps >= 0 */
+ MPFR_ASSERTN (mpfr_underflow_p ());
+ MPFR_ASSERTN (sign ? MPFR_IS_NEG (q) : MPFR_IS_POS (q));
+ if (i < 0)
+ mpfr_nexttozero (q);
+ MPFR_ASSERTN (MPFR_IS_ZERO (q));
+ mpfr_neg (d, d, GMP_RNDN);
+ }
}
set_emin (emin);