summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/mpfr-test.h7
-rw-r--r--tests/tabs.c4
-rw-r--r--tests/tadd.c16
-rw-r--r--tests/tconst_log2.c4
-rw-r--r--tests/tcoth.c5
-rw-r--r--tests/tdiv.c9
-rw-r--r--tests/tfma.c7
-rw-r--r--tests/tfmma.c2
-rw-r--r--tests/tfms.c7
-rw-r--r--tests/tgamma.c5
-rw-r--r--tests/tgeneric_ui.c2
-rw-r--r--tests/tget_f.c15
-rw-r--r--tests/tgmpop.c6
-rw-r--r--tests/tinternals.c8
-rw-r--r--tests/tmul_2exp.c10
-rw-r--r--tests/tpow.c5
-rw-r--r--tests/tpow3.c2
-rw-r--r--tests/tpow_all.c25
-rw-r--r--tests/trint.c4
-rw-r--r--tests/troot.c2
-rw-r--r--tests/tsec.c2
-rw-r--r--tests/tsech.c5
-rw-r--r--tests/tset_si.c5
-rw-r--r--tests/tsin_cos.c2
-rw-r--r--tests/tsqr.c7
-rw-r--r--tests/tstrtofr.c5
-rw-r--r--tests/tsub.c11
-rw-r--r--tests/tsum.c58
-rw-r--r--tests/tui_pow.c2
-rw-r--r--tests/tzeta_ui.c10
30 files changed, 76 insertions, 176 deletions
diff --git a/tests/mpfr-test.h b/tests/mpfr-test.h
index 616ef4119..c7d5f1057 100644
--- a/tests/mpfr-test.h
+++ b/tests/mpfr-test.h
@@ -51,12 +51,19 @@ extern "C" {
/* Generates a random rounding mode */
#define RND_RAND() ((mpfr_rnd_t) (randlimb() % MPFR_RND_MAX))
+/* Ditto, excluding RNDF, assumed to be the last rounding mode */
+#define RND_RAND_NO_RNDF() ((mpfr_rnd_t) (randlimb() % MPFR_RNDF))
+
/* Generates a random sign */
#define SIGN_RAND() ( (randlimb()%2) ? MPFR_SIGN_POS : MPFR_SIGN_NEG)
/* Loop for all rounding modes */
#define RND_LOOP(_r) for((_r) = 0 ; (_r) < MPFR_RND_MAX ; (_r)++)
+/* Loop for all rounding modes except RNDF (assumed to be the last one),
+ which must be excluded from tests that rely on deterministic results. */
+#define RND_LOOP_NO_RNDF(_r) for((_r) = 0 ; (_r) < MPFR_RNDF ; (_r)++)
+
/* Test whether two floating-point data have the same value,
seen as an element of the set of the floating-point data
(Level 2 in the IEEE 754-2008 standard). */
diff --git a/tests/tabs.c b/tests/tabs.c
index 60850c238..994f417d5 100644
--- a/tests/tabs.c
+++ b/tests/tabs.c
@@ -51,10 +51,8 @@ check_inexact (void)
for (q=2; q<2*p; q++)
{
mpfr_set_prec (y, q);
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
- if (rnd == MPFR_RNDF)
- continue; /* the test below makes no sense for RNDF */
inexact = mpfr_abs (y, x, (mpfr_rnd_t) rnd);
cmp = mpfr_cmp (y, absx);
if (((inexact == 0) && (cmp != 0)) ||
diff --git a/tests/tadd.c b/tests/tadd.c
index 5ed07c71f..d4bae55ee 100644
--- a/tests/tadd.c
+++ b/tests/tadd.c
@@ -519,9 +519,7 @@ check_inexact (void)
abs(EXP(x)-EXP(u)) + max(prec(x), prec(u)) + 1 */
pz = pz + MAX(MPFR_PREC(x), MPFR_PREC(u)) + 1;
mpfr_set_prec (z, pz);
- do
- rnd = RND_RAND ();
- while (rnd == MPFR_RNDF);
+ rnd = RND_RAND_NO_RNDF ();
if (test_add (z, x, u, rnd))
{
printf ("z <- x + u should be exact\n");
@@ -531,10 +529,7 @@ check_inexact (void)
exit (1);
}
{
- do
- rnd = RND_RAND ();
- while (rnd == MPFR_RNDF);
- /* the inexact return value has no sense with RNDF */
+ rnd = RND_RAND_NO_RNDF ();
inexact = test_add (y, x, u, rnd);
cmp = mpfr_cmp (y, z);
if (((inexact == 0) && (cmp != 0)) ||
@@ -635,7 +630,7 @@ check_overflow (void)
mpfr_init (b);
mpfr_init (c);
- RND_LOOP(r)
+ RND_LOOP_NO_RNDF (r)
for (prec_a = 2; prec_a <= 128; prec_a += 2)
for (prec_b = 2; prec_b <= 128; prec_b += 2)
for (prec_c = 2; prec_c <= 128; prec_c += 2)
@@ -751,10 +746,7 @@ check_1111 (void)
test_add (c, c, one, MPFR_RNDN);
diff = (randlimb () % (2*m)) - m;
mpfr_mul_2si (c, c, diff, MPFR_RNDN);
- /* the inex return value has no sense with RNDF */
- do
- rnd_mode = RND_RAND ();
- while (rnd_mode == MPFR_RNDF);
+ rnd_mode = RND_RAND_NO_RNDF ();
inex_a = test_add (a, b, c, rnd_mode);
mpfr_init2 (s, MPFR_PREC_MIN + 2*m);
inex_s = test_add (s, b, c, MPFR_RNDN); /* exact */
diff --git a/tests/tconst_log2.c b/tests/tconst_log2.c
index 905ca8607..81c19558f 100644
--- a/tests/tconst_log2.c
+++ b/tests/tconst_log2.c
@@ -40,11 +40,9 @@ check (mpfr_prec_t p0, mpfr_prec_t p1)
{
mpfr_set_prec (x, p0);
mpfr_set_prec (y, p0);
- RND_LOOP (i)
+ RND_LOOP_NO_RNDF (i)
{
mpfr_rnd_t rnd = (mpfr_rnd_t) i;
- if (rnd == MPFR_RNDF)
- continue; /* the test below makes no sense */
inex = mpfr_const_log2 (x, rnd);
inex_ref = mpfr_set (y, z, rnd);
if (! mpfr_can_round (z, mpfr_get_prec (z), MPFR_RNDN, rnd, p0))
diff --git a/tests/tcoth.c b/tests/tcoth.c
index 7a2782234..f89c62d19 100644
--- a/tests/tcoth.c
+++ b/tests/tcoth.c
@@ -141,11 +141,8 @@ underflowed_cothinf (void)
mpfr_init2 (y, 8);
for (i = -1; i <= 1; i += 2)
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
- if (rnd == MPFR_RNDF)
- continue; /* this test does not make sense, since RNDF does not
- give deterministic results */
mpfr_set_inf (x, i);
mpfr_clear_flags ();
set_emin (2); /* 1 is not representable. */
diff --git a/tests/tdiv.c b/tests/tdiv.c
index a0465545e..b1f184e11 100644
--- a/tests/tdiv.c
+++ b/tests/tdiv.c
@@ -414,11 +414,8 @@ check_hard (void)
mpfr_nextbelow (u);
for (i = 0; i <= 2; i++)
{
- RND_LOOP(rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
- if (rnd == MPFR_RNDF)
- continue; /* inexact is undefined */
-
inex = test_div (q, u, v, (mpfr_rnd_t) rnd);
inex2 = get_inexact (q, u, v);
if (inex_cmp (inex, inex2))
@@ -684,7 +681,7 @@ check_inexact (void)
mpfr_set_prec (z, py + pu);
{
/* inexact is undefined for RNDF */
- do rnd = RND_RAND (); while (rnd == MPFR_RNDF);
+ rnd = RND_RAND_NO_RNDF ();
inexact = test_div (y, x, u, rnd);
if (mpfr_mul (z, y, u, rnd))
{
@@ -984,7 +981,7 @@ consistency (void)
int inex1, inex2;
/* inex is undefined for RNDF */
- do rnd = RND_RAND (); while (rnd == MPFR_RNDF);
+ rnd = RND_RAND_NO_RNDF ();
px = (randlimb () % 256) + 2;
py = (randlimb () % 128) + 2;
pz = (randlimb () % 256) + 2;
diff --git a/tests/tfma.c b/tests/tfma.c
index dcd6e0654..333cafef9 100644
--- a/tests/tfma.c
+++ b/tests/tfma.c
@@ -124,13 +124,10 @@ test_overflow2 (void)
/* The intermediate multiplication x * y will overflow. */
for (i = -9; i <= 9; i++)
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
int inf, overflow;
- if (rnd == MPFR_RNDF)
- continue;
-
inf = rnd == MPFR_RNDN || rnd == MPFR_RNDD || rnd == MPFR_RNDA;
overflow = inf || i <= 0;
@@ -730,7 +727,7 @@ main (int argc, char *argv[])
if (randlimb () % 2)
mpfr_neg (z, z, MPFR_RNDN);
- rnd = RND_RAND ();
+ rnd = RND_RAND_NO_RNDF ();
mpfr_set_prec (slong, 2 * prec);
if (mpfr_mul (slong, x, y, rnd))
{
diff --git a/tests/tfmma.c b/tests/tfmma.c
index b510a0c78..423d353bf 100644
--- a/tests/tfmma.c
+++ b/tests/tfmma.c
@@ -263,7 +263,7 @@ overflow_tests (void)
set_emax (emax);
exp_a = emax/2 + 32;
- do rnd = RND_RAND (); while (rnd == MPFR_RNDF);
+ rnd = RND_RAND_NO_RNDF ();
prec_a = 64 + randlimb () % 100;
prec_z = MPFR_PREC_MIN + randlimb () % 160;
diff --git a/tests/tfms.c b/tests/tfms.c
index 8150d238b..b076b8021 100644
--- a/tests/tfms.c
+++ b/tests/tfms.c
@@ -126,13 +126,10 @@ test_overflow2 (void)
/* The intermediate multiplication x * y will overflow. */
for (i = -9; i <= 9; i++)
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
int inf, overflow;
- if (rnd == MPFR_RNDF)
- continue;
-
inf = rnd == MPFR_RNDN || rnd == MPFR_RNDD || rnd == MPFR_RNDA;
overflow = inf || i <= 0;
@@ -581,7 +578,7 @@ main (int argc, char *argv[])
if (randlimb () % 2)
mpfr_neg (z, z, MPFR_RNDN);
- rnd = RND_RAND ();
+ rnd = RND_RAND_NO_RNDF ();
mpfr_set_prec (slong, 2 * prec);
if (mpfr_mul (slong, x, y, rnd))
{
diff --git a/tests/tgamma.c b/tests/tgamma.c
index 84e2876ba..594f143fe 100644
--- a/tests/tgamma.c
+++ b/tests/tgamma.c
@@ -797,14 +797,11 @@ tiny_aux (int stop, mpfr_exp_t e)
spm = 1;
for (s = 0; s < 2; s++)
{
- RND_LOOP(r)
+ RND_LOOP_NO_RNDF (r)
{
mpfr_rnd_t rr = (mpfr_rnd_t) r;
mpfr_exp_t exponent, emax;
- if (rr == MPFR_RNDF)
- continue;
-
/* Exponent of the rounded value in unbounded exponent range. */
exponent = expected_dir[s][r] < 0 && s == 0 ? - e : 1 - e;
diff --git a/tests/tgeneric_ui.c b/tests/tgeneric_ui.c
index b7c53a97e..f05a4fc96 100644
--- a/tests/tgeneric_ui.c
+++ b/tests/tgeneric_ui.c
@@ -74,7 +74,7 @@ test_generic_ui (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N)
else /* unsigned */
u = n == 2 ? 0 : -1;
}
- do rnd = RND_RAND (); while (rnd == MPFR_RNDF);
+ rnd = RND_RAND_NO_RNDF ();
mpfr_set_prec (y, yprec);
compare = TEST_FUNCTION (y, x, u, rnd);
if (mpfr_can_round (y, yprec, rnd, rnd, prec))
diff --git a/tests/tget_f.c b/tests/tget_f.c
index b0af066c6..b73e2a503 100644
--- a/tests/tget_f.c
+++ b/tests/tget_f.c
@@ -185,13 +185,10 @@ ternary_test (void)
/* y == 1 */
mpfr_set_ui_2exp (y, 1, prec, MPFR_RNDN);
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
inex = mpfr_get_f (x, y, (mpfr_rnd_t) rnd);
- if (rnd == MPFR_RNDF)
- continue;
-
if (inex != 0 || mpfr_cmp_f (y, x) != 0)
{
printf ("Error (1) in mpfr_get_f (x, y, %s)\nx = ",
@@ -209,7 +206,7 @@ ternary_test (void)
/* y == 1 + epsilon */
mpfr_nextbelow (y);
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
switch (rnd)
{
@@ -223,9 +220,6 @@ ternary_test (void)
inex = mpfr_get_f (x, y, (mpfr_rnd_t) rnd);
- if (rnd == MPFR_RNDF)
- continue;
-
if (! SAME_SIGN (expected_inex, inex)
|| SAME_SIGN (expected_inex, mpfr_cmp_f (y, x)))
{
@@ -245,13 +239,10 @@ ternary_test (void)
/* y == positive random float */
mpfr_random2 (y, MPFR_LIMB_SIZE (y), 1024, RANDS);
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
inex = mpfr_get_f (x, y, (mpfr_rnd_t) rnd);
- if (rnd == MPFR_RNDF)
- continue;
-
if (! SAME_SIGN (inex, -mpfr_cmp_f (y, x)))
{
printf ("Error (3) in mpfr_get_f (x, y, %s)\nx = ",
diff --git a/tests/tgmpop.c b/tests/tgmpop.c
index 4110b8a7b..16320500d 100644
--- a/tests/tgmpop.c
+++ b/tests/tgmpop.c
@@ -571,7 +571,7 @@ test_genericz (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N,
{
mpfr_urandomb (arg1, RANDS);
mpz_urandomb (arg2, RANDS, 1024);
- do rnd = RND_RAND (); while (rnd == MPFR_RNDF);
+ rnd = RND_RAND_NO_RNDF ();
mpfr_set_prec (dst_big, 2*prec);
compare = func (dst_big, arg1, arg2, rnd);
if (mpfr_can_round (dst_big, 2*prec, rnd, rnd, prec))
@@ -648,7 +648,7 @@ test_generic2z (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N,
{
mpfr_urandomb (arg1, RANDS);
mpz_urandomb (arg2, RANDS, 1024);
- do rnd = RND_RAND (); while (rnd == MPFR_RNDF);
+ rnd = RND_RAND_NO_RNDF ();
mpfr_set_prec (dst_big, 2*prec);
compare = func(dst_big, arg2, arg1, rnd);
if (mpfr_can_round (dst_big, 2*prec, rnd, rnd, prec))
@@ -726,7 +726,7 @@ test_genericq (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N,
mpfr_urandomb (arg1, RANDS);
mpq_set_ui (arg2, randlimb (), randlimb() );
mpq_canonicalize (arg2);
- do rnd = RND_RAND (); while (rnd == MPFR_RNDF);
+ rnd = RND_RAND_NO_RNDF ();
mpfr_set_prec (dst_big, prec+10);
compare = func(dst_big, arg1, arg2, rnd);
if (mpfr_can_round (dst_big, prec+10, rnd, rnd, prec))
diff --git a/tests/tinternals.c b/tests/tinternals.c
index 6c670c451..0219509de 100644
--- a/tests/tinternals.c
+++ b/tests/tinternals.c
@@ -67,13 +67,8 @@ test_round_near_x (void)
mpfr_neg (x, x, MPFR_RNDN), p++, neg++)
for (err = 2; err <= 6; err++)
for (dir = 0; dir <= 1; dir++)
- RND_LOOP(r)
+ RND_LOOP_NO_RNDF (r)
{
- /* the test below takes into account the ternary value,
- which has no sense for RNDF */
- if (r == MPFR_RNDF)
- continue;
-
inex = mpfr_round_near_x (y, x, err, dir, (mpfr_rnd_t) r);
if (inex == 0 && err < 6)
@@ -85,7 +80,6 @@ test_round_near_x (void)
inex2 = ((dir ^ neg) ? mpfr_add : mpfr_sub)
(z, x, eps, (mpfr_rnd_t) r);
- /* MPFR_RNDF has no specified ternary value */
if (inex * inex2 <= 0)
printf ("Bad return value (%d instead of %d) for:\n",
inex, inex2);
diff --git a/tests/tmul_2exp.c b/tests/tmul_2exp.c
index e89179ddc..11bb2996d 100644
--- a/tests/tmul_2exp.c
+++ b/tests/tmul_2exp.c
@@ -69,12 +69,9 @@ underflow (mpfr_exp_t e)
for (prec = 6; prec >= 3; prec -= 3)
{
mpfr_inits2 (prec, z1, z2, (mpfr_ptr) 0);
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
for (k = 1; k <= 4; k++)
{
- if (rnd == MPFR_RNDF)
- continue; /* the test below makes no sense for RNDF */
-
/* The following one is assumed to be correct. */
inex1 = mpfr_mul_2si (y, x, e, MPFR_RNDN);
MPFR_ASSERTN (inex1 == 0);
@@ -268,14 +265,11 @@ overflow0 (mpfr_exp_t emax)
for (neg = 0; neg <= 1; neg++)
{
- RND_LOOP (r)
+ RND_LOOP_NO_RNDF (r)
{
int inex1, inex2;
mpfr_flags_t flags1, flags2;
- if (r == MPFR_RNDF)
- continue; /* the test below makes no sense for RNDF */
-
/* Even if there isn't an overflow (rounding ~ toward zero),
the result is the same as the one of an overflow. */
inex1 = mpfr_overflow (y1, (mpfr_rnd_t) r, neg ? -1 : 1);
diff --git a/tests/tpow.c b/tests/tpow.c
index bae723bc2..4d5c24bb2 100644
--- a/tests/tpow.c
+++ b/tests/tpow.c
@@ -1470,7 +1470,7 @@ bug20080721 (void)
MPFR_ASSERTN (inex == 0);
mpfr_set_str_binary (t[0], "-0.10101101e2");
mpfr_set_str_binary (t[1], "-0.10101110e2");
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
int i, inex0;
@@ -1479,9 +1479,6 @@ bug20080721 (void)
mpfr_clear_flags ();
inex = mpfr_pow (z, x, y, (mpfr_rnd_t) rnd);
- if (rnd == MPFR_RNDF)
- continue;
-
if (__gmpfr_flags != MPFR_FLAGS_INEXACT || ! SAME_SIGN (inex, inex0)
|| MPFR_IS_NAN (z) || mpfr_cmp (z, t[i]) != 0)
{
diff --git a/tests/tpow3.c b/tests/tpow3.c
index eace4058c..25a8947dc 100644
--- a/tests/tpow3.c
+++ b/tests/tpow3.c
@@ -61,7 +61,7 @@ main (int argc, char *argv[])
mpfr_urandomb (s, RANDS);
if (randlimb () % 2)
mpfr_neg (s, s, MPFR_RNDN);
- do rnd = RND_RAND (); while (rnd == MPFR_RNDF);
+ rnd = RND_RAND_NO_RNDF ();
mpfr_set_prec (y, yprec);
compare = mpfr_pow (y, x, s, rnd);
err = (rnd == MPFR_RNDN) ? yprec + 1 : yprec;
diff --git a/tests/tpow_all.c b/tests/tpow_all.c
index 2855d2cb2..f2868fbbd 100644
--- a/tests/tpow_all.c
+++ b/tests/tpow_all.c
@@ -368,14 +368,11 @@ tst (void)
for (i = 0; i < sv; i++)
for (j = 0; j < sv; j++)
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
int exact, inex;
unsigned int flags;
- if (rnd == MPFR_RNDF)
- continue;
-
if (my_setstr (x, val[i]) || my_setstr (y, val[j]))
{
printf ("internal error for (%d,%d,%d)\n", i, j, rnd);
@@ -511,13 +508,10 @@ underflow_up1 (void)
sprintf (sy, "emin - %d/4", i);
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
int zero;
- if (rnd == MPFR_RNDF)
- continue;
-
zero = (i > 4 && (rnd == MPFR_RNDZ || rnd == MPFR_RNDD)) ||
(i >= 8 && rnd == MPFR_RNDN);
@@ -582,15 +576,12 @@ underflow_up2 (void)
/* 0 < eps < 1 / (2n), thus (1 - eps)^n > 1/2,
and 1/2 (1/2)^n < (1/2 - eps/2)^n < (1/2)^n. */
mpfr_inits2 (64, z, z0, (mpfr_ptr) 0);
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
unsigned int ufinex = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT;
int expected_inex;
char sy[256];
- if (rnd == MPFR_RNDF)
- continue;
-
mpfr_set_ui (z0, 0, MPFR_RNDN);
expected_inex = rnd == MPFR_RNDN || rnd == MPFR_RNDU || rnd == MPFR_RNDA ?
(mpfr_nextabove (z0), 1) : -1;
@@ -623,14 +614,11 @@ underflow_up3 (void)
inex = mpfr_set_exp_t (y, mpfr_get_emin () - 2, MPFR_RNDN);
MPFR_ASSERTN (inex == 0);
for (i = -1; i <= 1; i++)
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
unsigned int ufinex = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT;
int expected_inex;
- if (rnd == MPFR_RNDF)
- continue;
-
mpfr_set_ui (x, 2, MPFR_RNDN);
if (i < 0)
mpfr_nextbelow (x);
@@ -702,14 +690,11 @@ overflow_inv (void)
* t = 0: always overflow
* t > 0: overflow for MPFR_RNDN and MPFR_RNDU.
*/
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
int inf, overflow;
mpfr_rnd_t rnd2;
- if (rnd == MPFR_RNDF)
- continue;
-
if (rnd == MPFR_RNDA)
rnd2 = s < 0 ? MPFR_RNDD : MPFR_RNDU;
else
diff --git a/tests/trint.c b/tests/trint.c
index 6aec8f20c..ed5719b51 100644
--- a/tests/trint.c
+++ b/tests/trint.c
@@ -285,10 +285,8 @@ basic_tests (void)
mpfr_set_si_2exp (x, s * i, -2, MPFR_RNDN);
e = mpfr_get_exp (x);
- RND_LOOP(r)
+ RND_LOOP_NO_RNDF (r)
{
- if (r == MPFR_RNDF)
- continue;
BASIC_TEST (trunc, s * (i/4));
BASIC_TEST (floor, s > 0 ? i/4 : - ((i+3)/4));
BASIC_TEST (ceil, s > 0 ? (i+3)/4 : - (i/4));
diff --git a/tests/troot.c b/tests/troot.c
index c70816241..d7ec9c84b 100644
--- a/tests/troot.c
+++ b/tests/troot.c
@@ -380,7 +380,7 @@ cmp_pow (void)
int inex1, inex2;
tests_default_random (x, 0, __gmpfr_emin, __gmpfr_emax, 1);
- do rnd = RND_RAND (); while (rnd == MPFR_RNDF);
+ rnd = RND_RAND_NO_RNDF ();
mpfr_set_ui_2exp (y1, 1, -h, MPFR_RNDN);
mpfr_clear_flags ();
inex1 = mpfr_pow (y1, x, y1, rnd);
diff --git a/tests/tsec.c b/tests/tsec.c
index 95d55e731..d00b51db8 100644
--- a/tests/tsec.c
+++ b/tests/tsec.c
@@ -96,7 +96,7 @@ overflowed_sec0 (void)
mpfr_nextbelow (y);
set_emax (emax); /* 1 is not representable. */
for (i = -1; i <= 1; i++)
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN);
mpfr_clear_flags ();
diff --git a/tests/tsech.c b/tests/tsech.c
index 9f5006ddb..f3929e7a9 100644
--- a/tests/tsech.c
+++ b/tests/tsech.c
@@ -114,11 +114,8 @@ overflowed_sech0 (void)
set_emax (emax); /* 1 is not representable. */
/* and if emax < 0, 1 - eps is not representable either. */
for (i = -1; i <= 1; i++)
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
- if (rnd == MPFR_RNDF)
- continue;
-
mpfr_set_si_2exp (x, i, -512 * ABS (i), MPFR_RNDN);
mpfr_clear_flags ();
inex = mpfr_sech (x, x, (mpfr_rnd_t) rnd);
diff --git a/tests/tset_si.c b/tests/tset_si.c
index e231dba46..33d6d46bf 100644
--- a/tests/tset_si.c
+++ b/tests/tset_si.c
@@ -220,14 +220,11 @@ static void get_tests (void)
{
ctr++;
/* x = t?[i] + j/4 */
- RND_LOOP (r)
+ RND_LOOP_NO_RNDF (r)
{
mpfr_flags_t ex_flags, flags;
int k, overflow;
- if (r == MPFR_RNDF)
- continue;
-
k = (j + 8 +
(MPFR_IS_LIKE_RNDD (r, MPFR_SIGN (x)) ? 0 :
MPFR_IS_LIKE_RNDU (r, MPFR_SIGN (x)) ? 3 :
diff --git a/tests/tsin_cos.c b/tests/tsin_cos.c
index 07cef1dbf..3aa0bd7c7 100644
--- a/tests/tsin_cos.c
+++ b/tests/tsin_cos.c
@@ -588,7 +588,7 @@ consistency (void)
else
{
tests_default_random (x, 256, -5, 50, 0);
- do rnd = RND_RAND (); while (rnd == MPFR_RNDF);
+ rnd = RND_RAND_NO_RNDF ();
flags_before = (randlimb () & 1) ?
(unsigned int) (MPFR_FLAGS_ALL ^ MPFR_FLAGS_ERANGE) :
(unsigned int) 0;
diff --git a/tests/tsqr.c b/tests/tsqr.c
index 1771ee206..c8c851a82 100644
--- a/tests/tsqr.c
+++ b/tests/tsqr.c
@@ -67,16 +67,13 @@ check_random (mpfr_prec_t p)
{
mpfr_urandomb (x, RANDS);
if (MPFR_IS_PURE_FP(x))
- RND_LOOP(r)
+ RND_LOOP_NO_RNDF (r)
{
- if (r == MPFR_RNDF)
- continue;
inexact1 = mpfr_mul (y, x, x, (mpfr_rnd_t) r);
inexact2 = mpfr_sqr (z, x, (mpfr_rnd_t) r);
if (mpfr_cmp (y, z))
error1 ((mpfr_rnd_t) r,p,x,y,z);
- if (inexact_sign (inexact1) != inexact_sign (inexact2) &&
- r != MPFR_RNDF)
+ if (inexact_sign (inexact1) != inexact_sign (inexact2))
error2 ((mpfr_rnd_t) r,p,x,y,inexact1,inexact2);
}
}
diff --git a/tests/tstrtofr.c b/tests/tstrtofr.c
index 0d416be70..24d507a4e 100644
--- a/tests/tstrtofr.c
+++ b/tests/tstrtofr.c
@@ -1157,13 +1157,10 @@ bug20120829 (void)
s[4+i] = 0;
inex1 = mpfr_mul_ui (e, e, 10, MPFR_RNDN);
MPFR_ASSERTN (inex1 == 0);
- RND_LOOP(r)
+ RND_LOOP_NO_RNDF (r)
{
mpfr_rnd_t rnd = (mpfr_rnd_t) r;
- if (r == MPFR_RNDF)
- continue;
-
inex1 = mpfr_exp10 (x1, e, rnd);
inex1 = SIGN (inex1);
inex2 = mpfr_strtofr (x2, s, NULL, 0, rnd);
diff --git a/tests/tsub.c b/tests/tsub.c
index 341ad4c6a..f008907ba 100644
--- a/tests/tsub.c
+++ b/tests/tsub.c
@@ -443,16 +443,14 @@ check_inexact (void)
: MPFR_EXP(u) - MPFR_EXP(x);
pz = pz + MAX(MPFR_PREC(x), MPFR_PREC(u));
mpfr_set_prec (z, pz);
- /* for RNDF, inexact makes no sense */
- do rnd = RND_RAND (); while (rnd == MPFR_RNDF);
+ rnd = RND_RAND_NO_RNDF ();
if (test_sub (z, x, u, rnd))
{
printf ("z <- x - u should be exact\n");
exit (1);
}
{
- /* for RNDF, inexact makes no sense */
- do rnd = RND_RAND (); while (rnd == MPFR_RNDF);
+ rnd = RND_RAND_NO_RNDF ();
inexact = test_sub (y, x, u, rnd);
cmp = mpfr_cmp (y, z);
if (((inexact == 0) && (cmp != 0)) ||
@@ -685,14 +683,11 @@ check_max_almosteven (void)
for (j = 1; j >= 0; j--)
{
mpfr_set_exp (b, __gmpfr_emax - j);
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
mpfr_flags_t flags1, flags2;
int inex1, inex2;
- if (rnd == MPFR_RNDF)
- continue;
-
/* Expected result. */
flags1 = MPFR_FLAGS_INEXACT;
if (rnd == MPFR_RNDN || MPFR_IS_LIKE_RNDZ (rnd, neg))
diff --git a/tests/tsum.c b/tests/tsum.c
index f56b797e6..637976e2a 100644
--- a/tests/tsum.c
+++ b/tests/tsum.c
@@ -116,12 +116,10 @@ generic_tests (void)
}
/* putchar ('\n'); */
get_exact_sum (exact_sum, t, n);
- RND_LOOP (rnd_mode)
+ RND_LOOP_NO_RNDF (rnd_mode)
{
int inex1, inex2;
- if (rnd_mode == MPFR_RNDF)
- continue; /* the test below makes no sense */
inex1 = mpfr_set (sum1, exact_sum, (mpfr_rnd_t) rnd_mode);
inex2 = mpfr_sum (sum2, p, n, (mpfr_rnd_t) rnd_mode);
if (!(mpfr_equal_p (sum1, sum2) && SAME_SIGN (inex1, inex2)))
@@ -397,10 +395,8 @@ check1 (int h)
{
mpfr_set_prec (sum1, prec);
mpfr_set_prec (sum2, prec);
- RND_LOOP (r)
+ RND_LOOP_NO_RNDF (r)
{
- if (r == MPFR_RNDF)
- continue; /* the test below makes no sense */
inex1 = mpfr_set (sum1, s3, (mpfr_rnd_t) r);
inex2 = mpfr_sum (sum2, p, 4, (mpfr_rnd_t) r);
MPFR_ASSERTN (mpfr_check (sum1));
@@ -484,10 +480,8 @@ check2 (void)
prec = mpfr_get_exp (s4);
mpfr_set_prec (sum1, prec);
mpfr_set_prec (sum2, prec);
- RND_LOOP (r)
+ RND_LOOP_NO_RNDF (r)
{
- if (r == MPFR_RNDF)
- continue; /* the test below makes no sense */
inex1 = mpfr_set (sum1, s4, (mpfr_rnd_t) r);
inex2 = mpfr_sum (sum2, p, 5, (mpfr_rnd_t) r);
MPFR_ASSERTN (mpfr_check (sum1));
@@ -572,10 +566,8 @@ check3 (void)
for (q = 0; q < 2; q++)
{
mpfr_inits2 (prec[q], sum1, sum2, (mpfr_ptr) 0);
- RND_LOOP (r)
+ RND_LOOP_NO_RNDF (r)
{
- if (r == MPFR_RNDF)
- continue; /* the test below makes no sense */
mpfr_clear_flags ();
inex1 = mpfr_set (sum1, s4, (mpfr_rnd_t) r);
flags1 = __gmpfr_flags;
@@ -673,9 +665,7 @@ check4 (void)
mpfr_set_si_2exp (t[4], j, -2, MPFR_RNDN);
inex1 = mpfr_add (s4, s3, t[4], MPFR_RNDN);
MPFR_ASSERTN (inex1 == 0);
- RND_LOOP (r) {
- if (r == MPFR_RNDF)
- continue; /* the test below makes no sense */
+ RND_LOOP_NO_RNDF (r) {
inex1 = mpfr_set (sum1, s4, (mpfr_rnd_t) r);
inex2 = mpfr_sum (sum2, p, 5, (mpfr_rnd_t) r);
MPFR_ASSERTN (mpfr_check (sum1));
@@ -776,13 +766,10 @@ bug20150327 (void)
p[i] = t[i];
}
- RND_LOOP(r)
+ RND_LOOP_NO_RNDF (r)
{
int inex1, inex2;
- if (r == MPFR_RNDF)
- continue; /* the test below makes no sense */
-
mpfr_set (sum1, t[2], MPFR_RNDN);
inex1 = -1;
if (MPFR_IS_LIKE_RNDU ((mpfr_rnd_t) r, 1))
@@ -827,11 +814,9 @@ check_extreme (void)
mpfr_setmin (u, mpfr_get_emax ());
mpfr_setmax (v, mpfr_get_emin ());
mpfr_setmin (w, mpfr_get_emax () - 40);
- RND_LOOP (r)
+ RND_LOOP_NO_RNDF (r)
for (i = 0; i < 2; i++)
{
- if (r == MPFR_RNDF)
- continue; /* the test below makes no sense */
mpfr_set_prec (x, 64);
inex1 = mpfr_add (x, u, w, MPFR_RNDN);
MPFR_ASSERTN (inex1 == 0);
@@ -1171,21 +1156,20 @@ check_coverage (void)
int r, i, j, k, p, q;
int err = 0;
- for (r = 0; r < MPFR_RND_MAX; r++)
- if (r != MPFR_RNDF)
- for (i = 0; i < 1 + ((mpfr_rnd_t) r == MPFR_RNDN); i++)
- for (j = 0; j < 2; j++)
- for (k = 0; k < 3; k++)
- for (p = 0; p < 2; p++)
- for (q = 0; q < 2; q++)
- if (!__gmpfr_cov_sum_tmd[r][i][j][k][p][q])
- {
- printf ("TMD not tested on %s, tmd=%d, rbit=%d, sst=%d,"
- " %s, sq %s MPFR_PREC_MIN\n",
- mpfr_print_rnd_mode ((mpfr_rnd_t) r), i+1, j, k-1,
- p ? "pos" : "neg", q ? ">" : "==");
- err = 1;
- }
+ RND_LOOP_NO_RNDF (r)
+ for (i = 0; i < 1 + ((mpfr_rnd_t) r == MPFR_RNDN); i++)
+ for (j = 0; j < 2; j++)
+ for (k = 0; k < 3; k++)
+ for (p = 0; p < 2; p++)
+ for (q = 0; q < 2; q++)
+ if (!__gmpfr_cov_sum_tmd[r][i][j][k][p][q])
+ {
+ printf ("TMD not tested on %s, tmd=%d, rbit=%d, sst=%d,"
+ " %s, sq %s MPFR_PREC_MIN\n",
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r), i+1, j, k-1,
+ p ? "pos" : "neg", q ? ">" : "==");
+ err = 1;
+ }
if (err)
exit (1);
diff --git a/tests/tui_pow.c b/tests/tui_pow.c
index 2a6acab74..3ee74118d 100644
--- a/tests/tui_pow.c
+++ b/tests/tui_pow.c
@@ -244,7 +244,7 @@ main (int argc, char *argv[])
int nt;
nt = randlimb () & INT_MAX;
mpfr_urandomb (x, RANDS);
- do rnd = RND_RAND (); while (rnd == MPFR_RNDF);
+ rnd = RND_RAND_NO_RNDF ();
check1 (x, prec, nt, rnd);
}
}
diff --git a/tests/tzeta_ui.c b/tests/tzeta_ui.c
index 77bb15744..ddaa4e5b8 100644
--- a/tests/tzeta_ui.c
+++ b/tests/tzeta_ui.c
@@ -74,13 +74,10 @@ main (int argc, char *argv[])
MPFR_ASSERTN (inex == 0 && mpfr_cmp_si_2exp (x, -1, -1) == 0 && flags == 0);
for (i = -2; i <= 2; i += 2)
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
int ex_inex;
- if (rnd == MPFR_RNDF)
- continue;
-
set_emin (i);
set_emax (i);
mpfr_clear_flags ();
@@ -153,11 +150,8 @@ main (int argc, char *argv[])
mpfr_set_prec (y, yprec);
for (n = 0; n < 50; n++)
- RND_LOOP (rnd)
+ RND_LOOP_NO_RNDF (rnd)
{
- if (rnd == MPFR_RNDF)
- continue;
-
mpfr_zeta_ui (y, n, MPFR_RNDN);
if (mpfr_can_round (y, yprec, MPFR_RNDN, MPFR_RNDZ, prec
+ (rnd == MPFR_RNDN)))