summaryrefslogtreecommitdiff
path: root/tests/tmul_2exp.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2008-08-12 22:03:37 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2008-08-12 22:03:37 +0000
commite3dd97d91b3b6c597aaf887208cf4ad6f994e72c (patch)
tree757dde1f1fef42de13d325cb661a1a3994653e3f /tests/tmul_2exp.c
parent26c562199943aa157ec198d9a531a0353c7d8abf (diff)
downloadmpfr-e3dd97d91b3b6c597aaf887208cf4ad6f994e72c.tar.gz
mul_2si.c, div_2si.c, div_2ui.c: fixed double-rounding problem in
rounding to nearest when the rounded result in unbounded exponent range is 2^(emin - 2). tests/tmul_2exp.c: test x = 15/16 too. Now tmul_2exp no longer fails (with the correction in div.c from r5515). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5517 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tmul_2exp.c')
-rw-r--r--tests/tmul_2exp.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/tmul_2exp.c b/tests/tmul_2exp.c
index b42ce3325..3b1c23596 100644
--- a/tests/tmul_2exp.c
+++ b/tests/tmul_2exp.c
@@ -58,15 +58,16 @@ underflow (mp_exp_t e)
unsigned int flags1, flags2;
/* Test mul_2si(x, e - k), div_2si(x, k - e) and div_2ui(x, k - e)
- * with emin = e, x = 1 and 17/16, and k = 1 to 4, by comparing the
- * result with the one of a simple division.
+ * with emin = e, x = 1 + i/16, i in { -1, 0, 1 }, and k = 1 to 4,
+ * by comparing the result with the one of a simple division.
*/
emin = mpfr_get_emin ();
set_emin (e);
mpfr_inits2 (8, x, y, (mpfr_ptr) 0);
- for (i = 16; i <= 17; i++)
+ for (i = 15; i <= 17; i++)
{
- mpfr_set_ui_2exp (x, i, -4, GMP_RNDN);
+ inex1 = mpfr_set_ui_2exp (x, i, -4, GMP_RNDN);
+ MPFR_ASSERTN (inex1 == 0);
for (prec = 6; prec >= 3; prec -= 3)
{
mpfr_inits2 (prec, z1, z2, (mpfr_ptr) 0);
@@ -102,7 +103,7 @@ underflow (mp_exp_t e)
printf ("default emin");
else
printf ("%ld", e);
- printf (")\nwith %s, x = %d/4, prec = %d, k = %d, mpfr_%s",
+ printf (")\nwith %s, x = %d/16, prec = %d, k = %d, mpfr_%s",
div == 0 ? "mul_2si" : div == 1 ? "div_2si" :
"div_2ui", i, prec, k, mpfr_print_rnd_mode (rnd));
printf ("\nExpected ");