summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2021-02-15 18:35:23 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2021-02-15 18:35:23 +0000
commitb4ed32b18f73320f5de68d6c0ca07cf1f9e06cb4 (patch)
tree1d5c1158aa4acc0f45222bdf927a9a2fef85fe90 /tests
parentf85609cb0e9e16a9c1e7eb04adde1a8b3f9dfda3 (diff)
downloadmpfr-b4ed32b18f73320f5de68d6c0ca07cf1f9e06cb4.tar.gz
[tests/mpfr-test.h] Added mpfr_cmp_si_2exp0 macro (check NaN).
[tests/tj1.c] Replaced mpfr_cmp_si_2exp by mpfr_cmp_si_2exp0. git-svn-id: https://scm.gforge.inria.fr/anonscm/svn/mpfr/trunk@14434 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r--tests/mpfr-test.h2
-rw-r--r--tests/tj1.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/tests/mpfr-test.h b/tests/mpfr-test.h
index f1ecfada3..0466903d3 100644
--- a/tests/mpfr-test.h
+++ b/tests/mpfr-test.h
@@ -192,6 +192,8 @@ int mpfr_cmp_str (mpfr_srcptr x, const char *, int, mpfr_rnd_t);
#define mpfr_cmp0(x,y) (MPFR_ASSERTN (!MPFR_IS_NAN (x) && !MPFR_IS_NAN (y)), mpfr_cmp (x,y))
#define mpfr_cmp_ui0(x,i) (MPFR_ASSERTN (!MPFR_IS_NAN (x)), mpfr_cmp_ui (x,i))
#define mpfr_cmp_si0(x,i) (MPFR_ASSERTN (!MPFR_IS_NAN (x)), mpfr_cmp_si (x,i))
+#define mpfr_cmp_si_2exp0(x,i,e) (MPFR_ASSERTN (!MPFR_IS_NAN (x)), \
+ mpfr_cmp_si_2exp (x,i,e))
/* define CHECK_EXTERNAL if you want to check mpfr against another library
with correct rounding. You'll probably have to modify mpfr_print_raw()
diff --git a/tests/tj1.c b/tests/tj1.c
index 0a2709143..9e3fd0710 100644
--- a/tests/tj1.c
+++ b/tests/tj1.c
@@ -55,14 +55,14 @@ test_small (void)
/* since |x| is just above 2^e, |j1(x)| is just above 2^(e-1),
thus y should be 2^(e-1) and the inexact flag should be
of opposite sign of x */
- MPFR_ASSERTN(mpfr_cmp_si_2exp (y, sign, e - 1) == 0);
+ MPFR_ASSERTN(mpfr_cmp_si_2exp0 (y, sign, e - 1) == 0);
MPFR_ASSERTN(VSIGN (inex) * sign < 0);
}
else
{
/* here |y| should be 0.5*2^emin and the inexact flag should
have the sign of x */
- MPFR_ASSERTN(mpfr_cmp_si_2exp (y, sign, e) == 0);
+ MPFR_ASSERTN(mpfr_cmp_si_2exp0 (y, sign, e) == 0);
MPFR_ASSERTN(VSIGN (inex) * sign > 0);
}
}
@@ -85,7 +85,7 @@ bug20210215 (void)
mpfr_set_str (x, "1.6484611511696130037307738844228498447763863563070374544054791168614e+01", 10, MPFR_RNDN);
mpfr_clear_flags ();
inex = mpfr_j1 (y, x, MPFR_RNDZ);
- MPFR_ASSERTN (mpfr_cmp_si_2exp (y, -1, -9) == 0);
+ MPFR_ASSERTN (mpfr_cmp_si_2exp0 (y, -1, -9) == 0);
MPFR_ASSERTN (inex > 0);
MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_INEXACT);
mpfr_clear (x);