diff options
-rw-r--r-- | mul.c | 4 | ||||
-rw-r--r-- | tests/tmul.c | 17 |
2 files changed, 20 insertions, 1 deletions
@@ -395,7 +395,9 @@ mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) /* We will compute with one extra limb */ n++; p = n*BITS_PER_MP_LIMB - MPFR_INT_CEIL_LOG2 (n + 2); - MPFR_ASSERTD (MPFR_PREC (a) <= p - 5); + /* Due to some nasty reasons we can have only 4 bits */ + MPFR_ASSERTD (MPFR_PREC (a) <= p - 4); + if (MPFR_LIKELY (k < 2*n)) { tmp = TMP_ALLOC (2*n*sizeof (mp_limb_t)); diff --git a/tests/tmul.c b/tests/tmul.c index 869a2ed00..7a5352dc8 100644 --- a/tests/tmul.c +++ b/tests/tmul.c @@ -601,6 +601,23 @@ check_regression (void) exit (1); } + mpfr_set_prec (x, 439); + mpfr_set_prec (y, 393); + mpfr_set_str (y, "-1.921fb54442d18469898cc51701b839a252049c1114cf98e804177d" + "4c76273644a29410f31c6809bbdf2a33679a748636600", + 16, GMP_RNDN); + i = mpfr_mul (x, y, y, GMP_RNDU); + if (mpfr_cmp_str (x, "2.77a79937c8bbcb495b89b36602306b1c2159a8ff834288a19a08" + "84094f1cda3dc426da61174c4544a173de83c2500f8bfea2e0569e3698", + 16, GMP_RNDN) != 0 + || i <= 0) + { + printf ("Regression test (7) failed! (i=%d - expected 1)\nx=", i); + mpfr_out_str (stdout, 16, 0, x, GMP_RNDN); + printf ("\n"); + exit (1); + } + mpfr_clears (x, y, z, NULL); } |