summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-05-29 22:48:06 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-05-29 22:48:06 +0000
commit06fde1bd718985d98dcb9bce10942238a09d1f7e (patch)
tree840d1d413027ff765a9a00e09f6dc3998b538f6e /tests
parentb9a39d56b8812338b4483fcc45a5df0d65993ff9 (diff)
downloadmpfr-06fde1bd718985d98dcb9bce10942238a09d1f7e.tar.gz
[tests] Code simplification and improvement by using SAME_VAL().
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11551 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r--tests/tdiv.c3
-rw-r--r--tests/tests.c2
-rw-r--r--tests/tpow_all.c5
-rw-r--r--tests/tsum.c4
4 files changed, 4 insertions, 10 deletions
diff --git a/tests/tdiv.c b/tests/tdiv.c
index 67ecebd31..9b4988aac 100644
--- a/tests/tdiv.c
+++ b/tests/tdiv.c
@@ -26,8 +26,7 @@ static void
check_equal (mpfr_srcptr a, mpfr_srcptr a2, char *s,
mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t r)
{
- if ((MPFR_IS_NAN (a) && MPFR_IS_NAN (a2)) ||
- mpfr_equal_p (a, a2))
+ if (SAME_VAL (a, a2))
return;
if (r == MPFR_RNDF) /* RNDF might return different values */
return;
diff --git a/tests/tests.c b/tests/tests.c
index ebcb81eb0..1e85126fa 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -684,7 +684,7 @@ test5rm (int (*fct) (FLIST), mpfr_srcptr x, mpfr_ptr y, mpfr_ptr z,
MPFR_ASSERTN (rnd != MPFR_RND_MAX);
inex = fct (z, x, rnd);
- if (! (mpfr_equal_p (y, z) || (mpfr_nan_p (y) && mpfr_nan_p (z))))
+ if (! SAME_VAL (y, z))
{
printf ("Error for %s with xprec=%lu, yprec=%lu, rnd=%s\nx = ",
name, (unsigned long) MPFR_PREC (x), (unsigned long) yprec,
diff --git a/tests/tpow_all.c b/tests/tpow_all.c
index f8ca5e653..7783b607d 100644
--- a/tests/tpow_all.c
+++ b/tests/tpow_all.c
@@ -87,10 +87,7 @@ cmpres (int spx, const void *px, const char *sy, mpfr_rnd_t rnd,
if (MPFR_IS_PURE_FP (z2))
return;
}
- else if (SAME_SIGN (inex1, inex2) &&
- ((MPFR_IS_NAN (z1) && MPFR_IS_NAN (z2)) ||
- ((MPFR_IS_NEG (z1) ^ MPFR_IS_NEG (z2)) == 0 &&
- mpfr_equal_p (z1, z2))))
+ else if (SAME_SIGN (inex1, inex2) && SAME_VAL (z1, z2))
return;
}
diff --git a/tests/tsum.c b/tests/tsum.c
index 05d7f64b6..f1c814731 100644
--- a/tests/tsum.c
+++ b/tests/tsum.c
@@ -314,9 +314,7 @@ check_more_special (void)
k[i++] = 0;
}
inex = mpfr_sum (sum, p, NS, (mpfr_rnd_t) r);
- if (! ((MPFR_IS_NAN (sum) && MPFR_IS_NAN (s[NS-1])) ||
- (mpfr_equal_p (sum, s[NS-1]) &&
- MPFR_SIGN (sum) == MPFR_SIGN (s[NS-1]))) || inex != 0)
+ if (! SAME_VAL (sum, s[NS-1]) || inex != 0)
{
printf ("Error in check_more_special on %s",
mpfr_print_rnd_mode ((mpfr_rnd_t) r));