summaryrefslogtreecommitdiff
path: root/tests/tdiv.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2008-08-12 22:27:44 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2008-08-12 22:27:44 +0000
commit3671e04acf01798b1f367d5d9de303bf9039bd69 (patch)
tree8d88c484cc69667c24704341c250d84bc8f2d210 /tests/tdiv.c
parente3dd97d91b3b6c597aaf887208cf4ad6f994e72c (diff)
downloadmpfr-3671e04acf01798b1f367d5d9de303bf9039bd69.tar.gz
tests/tdiv.c: completed underflow test by testing negative results too.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5519 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tdiv.c')
-rw-r--r--tests/tdiv.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/tests/tdiv.c b/tests/tdiv.c
index a2b23e293..3e87e5355 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);