diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-02-14 11:11:31 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-02-14 11:11:31 +0000 |
commit | f095a6c8a44a63379841097ddfbf4682e56e4036 (patch) | |
tree | ff27c1422f6c4e9e704d35ffc9953571a796f11c /tests/tmul.c | |
parent | aedeae287d6c8de47317f93227626653a622d3ee (diff) | |
download | mpfr-f095a6c8a44a63379841097ddfbf4682e56e4036.tar.gz |
improved coverage test
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2713 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tmul.c')
-rw-r--r-- | tests/tmul.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/tmul.c b/tests/tmul.c index 9cd2ce08c..e825effda 100644 --- a/tests/tmul.c +++ b/tests/tmul.c @@ -257,6 +257,7 @@ static void check_max(void) { mpfr_t xx, yy, zz; + mp_exp_t emin; mpfr_init2(xx, 4); mpfr_init2(yy, 4); @@ -297,6 +298,28 @@ check_max(void) exit(1); } + /* check underflow */ + emin = mpfr_get_emin (); + mpfr_set_emin (0); + mpfr_set_str_binary (xx, "0.1E0"); + mpfr_set_str_binary (yy, "0.1E0"); + mpfr_mul (zz, xx, yy, GMP_RNDN); + /* exact result is 0.1E-1, which should round to 0 */ + MPFR_ASSERTN(mpfr_cmp_ui (zz, 0) == 0 && MPFR_IS_POS(zz)); + mpfr_set_emin (emin); + + /* coverage test for mpfr_powerof2_raw */ + emin = mpfr_get_emin (); + mpfr_set_emin (0); + mpfr_set_prec (xx, mp_bits_per_limb + 1); + mpfr_set_str_binary (xx, "0.1E0"); + mpfr_nextabove (xx); + mpfr_set_str_binary (yy, "0.1E0"); + mpfr_mul (zz, xx, yy, GMP_RNDN); + /* exact result is just above 0.1E-1, which should round to minfloat */ + MPFR_ASSERTN(mpfr_cmp (zz, yy) == 0); + mpfr_set_emin (emin); + mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz); |