diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-04-11 14:03:03 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-04-11 14:03:03 +0000 |
commit | db94a9057eeb5919b58f96141490ceb39be0157b (patch) | |
tree | 1ef2b54d705d5e50cccfe2a03c7e6bd4e65be8dc | |
parent | 985398b4b9dadafbdc1600e12707dee74cab4cd8 (diff) | |
download | mpfr-db94a9057eeb5919b58f96141490ceb39be0157b.tar.gz |
[tests] Merged the test from r12348, and replaced MUL_FFT_THRESHOLD
by its default value 8448 (since the definition of MUL_FFT_THRESHOLD
has not been moved in the 4.0 branch).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/4.0@12580 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | tests/tmul.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/tmul.c b/tests/tmul.c index 7448e0c80..0e3365d8c 100644 --- a/tests/tmul.c +++ b/tests/tmul.c @@ -267,10 +267,11 @@ check_exact (void) } static void -check_max(void) +check_max (void) { mpfr_t xx, yy, zz; mpfr_exp_t emin; + int inex; mpfr_init2(xx, 4); mpfr_init2(yy, 4); @@ -333,6 +334,20 @@ check_max(void) MPFR_ASSERTN(mpfr_cmp (zz, yy) == 0); set_emin (emin); + /* coverage test for mulders.c, case n > 8448 (MUL_FFT_THRESHOLD default) */ + mpfr_set_prec (xx, (8448 + 1) * GMP_NUMB_BITS); + mpfr_set_prec (yy, (8448 + 1) * GMP_NUMB_BITS); + mpfr_set_prec (zz, (8448 + 1) * GMP_NUMB_BITS); + mpfr_set_ui (xx, 1, MPFR_RNDN); + mpfr_nextbelow (xx); + mpfr_set_ui (yy, 1, MPFR_RNDN); + mpfr_nextabove (yy); + /* xx = 1 - 2^(-p), yy = 1 + 2^(1-p), where p = PREC(x), + thus xx * yy should be rounded to 1 */ + inex = mpfr_mul (zz, xx, yy, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_cmp_ui (zz, 1) == 0); + mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz); |