diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-06-07 09:52:04 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-06-07 09:52:04 +0000 |
commit | ea68a79433838bb336f2003ce9ca4ffe5ba526ba (patch) | |
tree | 741e58b0303ec16f1f31e9fc0e56f65bf9fdd3ea /tests | |
parent | b6f2642cf364b8b00441bfb5ea4dbe1f35a02f19 (diff) | |
download | mpfr-ea68a79433838bb336f2003ce9ca4ffe5ba526ba.tar.gz |
Improve coverage.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3620 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tconst_pi.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/tests/tconst_pi.c b/tests/tconst_pi.c index 50e9a2cfc..8dda40f31 100644 --- a/tests/tconst_pi.c +++ b/tests/tconst_pi.c @@ -29,19 +29,26 @@ MA 02110-1301, USA. */ static void check_large (void) { - mpfr_t x, y; + mpfr_t x, y, z; mpfr_init2 (x, 20000); mpfr_init2 (y, 21000); + mpfr_init2 (z, 11791); - (mpfr_const_pi) (x, GMP_RNDN); /* First one ! */ - (mpfr_const_pi) (y, GMP_RNDN); /* Then the other - cache - */ + /* The algo failed to round for p=11791. */ + (mpfr_const_pi) (z, GMP_RNDU); + mpfr_const_pi (x, GMP_RNDN); /* First one ! */ + mpfr_const_pi (y, GMP_RNDN); /* Then the other - cache - */ mpfr_prec_round (y, 20000, GMP_RNDN); - if (mpfr_cmp (x,y)) - { - printf ("const_pi: error for large prec\n"); - exit (1); - } + if (mpfr_cmp (x, y)) { + printf ("const_pi: error for large prec (%d)\n", 1); + exit (1); + } + mpfr_prec_round (y, 11791, GMP_RNDU); + if (mpfr_cmp (z, y)) { + printf ("const_pi: error for large prec (%d)\n", 2); + exit (1); + } /* a worst-case to exercise recomputation */ if (MPFR_PREC_MAX > 33440) { @@ -49,7 +56,7 @@ check_large (void) mpfr_const_pi (x, GMP_RNDZ); } - mpfr_clears (x, y, NULL); + mpfr_clears (x, y, z, NULL); } int |