diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-09-18 13:42:12 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-09-18 13:42:12 +0000 |
commit | be75e2ebd72504ef5c59b2360da7c00fdcf88241 (patch) | |
tree | 7dd5f5034f6457c2595d773bc9f399bdba94020b /tests/tfrac.c | |
parent | 1a5481b884fbbb33634c8467b53055def80aeed4 (diff) | |
download | mpfr-be75e2ebd72504ef5c59b2360da7c00fdcf88241.tar.gz |
tests/tfrac.c: also test the overflow case.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6465 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tfrac.c')
-rw-r--r-- | tests/tfrac.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/tfrac.c b/tests/tfrac.c index 2414418af..1a772935f 100644 --- a/tests/tfrac.c +++ b/tests/tfrac.c @@ -180,17 +180,23 @@ bug20090918 (void) int inexy, inexz; int r, i; char *s[] = { "61680.352935791015625", "61680.999999" }; + mp_exp_t emax; + + emax = mpfr_get_emax (); mpfr_init2 (x, 32); mpfr_init2 (y, 13); - for (i = 0; i <= 1; i++) + for (i = 0; i <= 3; i++) { - mpfr_set_str (x, s[i], 10, MPFR_RNDZ); + mpfr_set_str (x, s[i & 1], 10, MPFR_RNDZ); RND_LOOP(r) { + if (i & 2) + set_emax (0); inexy = mpfr_frac (y, x, (mpfr_rnd_t) r); + set_emax (emax); y0 = MPFR_MANT(y)[0]; while (y0 != 0 && (y0 >> 1) << 1 == y0) y0 >>= 1; @@ -204,7 +210,10 @@ bug20090918 (void) mpfr_init2 (z, 32); inexz = mpfr_frac (z, x, MPFR_RNDN); MPFR_ASSERTN (inexz == 0); /* exact */ + if (i & 2) + set_emax (0); inexz = mpfr_prec_round (z, 13, (mpfr_rnd_t) r); + set_emax (emax); if (mpfr_cmp0 (y, z) != 0) { printf ("Error in bug20090918, i = %d, %s.\n", i, |