diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-08-27 15:18:25 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-08-27 15:18:25 +0000 |
commit | 5ee611ccd24d147954b62b894ce917596234103d (patch) | |
tree | 68609274f8e708a0906c11fb8ee963ce7e76d844 /tests/tmul.c | |
parent | 0bab294f3f1cf0f42f49d659a49659df0c078373 (diff) | |
download | mpfr-5ee611ccd24d147954b62b894ce917596234103d.tar.gz |
[tests/tmul.c] improve coverage
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13044 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tmul.c')
-rw-r--r-- | tests/tmul.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/tmul.c b/tests/tmul.c index 427531632..521cd4dd5 100644 --- a/tests/tmul.c +++ b/tests/tmul.c @@ -1268,12 +1268,42 @@ coverage (mpfr_prec_t pmax) } } +/* check special underflow case for precision = 64 */ +static void +coverage2 (void) +{ + mpfr_t a, b, c; + int inex; + mpfr_exp_t emin; + + emin = mpfr_get_emin (); /* save emin */ + mpfr_set_emin (0); + + mpfr_init2 (a, 64); + mpfr_init2 (b, 64); + mpfr_init2 (c, 64); + + mpfr_set_str_binary (b, "1111110110100001011100100000100000110110001100100010011010011001E-64"); /* 18276014142440744601/2^64 */ + mpfr_set_str_binary (c, "1000000100110010000111000100010010010001000100101010111101010100E-64"); /* 9309534460545511252/2^64 */ + /* since 1/2-2^-66 < b0*c0 < 1/2, b0*c0 should be rounded to 1/2 */ + inex = mpfr_mul (a, b, c, MPFR_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (a, 1, -1) == 0); + MPFR_ASSERTN(inex > 0); + + mpfr_clear (a); + mpfr_clear (b); + mpfr_clear (c); + + mpfr_set_emin (emin); /* restore emin */ +} + int main (int argc, char *argv[]) { tests_start_mpfr (); coverage (1024); + coverage2 (); testall_rndf (9); check_nans (); check_exact (); |