diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-06-24 08:14:39 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-06-24 08:14:39 +0000 |
commit | 99928ba610e0262886d403ea0b3e86b8683bcbcd (patch) | |
tree | 0d8afca069ab368c4511f65cbdb6891968a84013 | |
parent | 97248731a07a4f57d308376b2984ae3e9f8ec188 (diff) | |
download | mpfr-99928ba610e0262886d403ea0b3e86b8683bcbcd.tar.gz |
correction to previous patch: problem was that x and u can be 0,
then MPFR_PREC() undefined
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2362 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | tests/tadd.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/tadd.c b/tests/tadd.c index 2ad1f4ce0..b7ca2a10f 100644 --- a/tests/tadd.c +++ b/tests/tadd.c @@ -454,20 +454,27 @@ check_inexact (void) for (px=2; px<MAX_PREC; px++) { mpfr_set_prec (x, px); - mpfr_random (x); + do + { + mpfr_random (x); + } + while (mpfr_cmp_ui (x, 0) == 0); for (pu=2; pu<MAX_PREC; pu++) { mpfr_set_prec (u, pu); - mpfr_random (u); + do + { + mpfr_random (u); + } + while (mpfr_cmp_ui (u, 0) == 0); for (py=2; py<MAX_PREC; py++) { mpfr_set_prec (y, py); - pz = (mpfr_cmpabs (x, u) >= 0) ? MPFR_EXP(x)-MPFR_EXP(u) - : MPFR_EXP(u)-MPFR_EXP(x); + pz = (mpfr_cmpabs (x, u) >= 0) ? MPFR_EXP(x) - MPFR_EXP(u) + : MPFR_EXP(u) - MPFR_EXP(x); /* x + u is exactly representable with precision abs(EXP(x)-EXP(u)) + max(prec(x), prec(u)) + 1 */ - pz = MAX (MPFR_PREC_MIN, - pz + MAX(MPFR_PREC(x), MPFR_PREC(u)) + 1); + pz = pz + MAX(MPFR_PREC(x), MPFR_PREC(u)) + 1; mpfr_set_prec (z, pz); rnd = randlimb () % 4; if (mpfr_add (z, x, u, rnd)) |