summaryrefslogtreecommitdiff
path: root/mul.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-03-24 10:47:41 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-03-24 10:47:41 +0000
commite62332ff03a6fe7486a6b490ba32dc3604ba8b74 (patch)
tree41d4479fcde742cb5ee856b819a931d0a05d39df /mul.c
parent36a699bc39ff00e5bf9115d9fe429655e08acb97 (diff)
downloadmpfr-e62332ff03a6fe7486a6b490ba32dc3604ba8b74.tar.gz
Fix wrong extimated precision.
It is log2(n+2) ulps so that log2(log2(n+2)) bits! git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3405 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'mul.c')
-rw-r--r--mul.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mul.c b/mul.c
index a939988d2..29ff101b4 100644
--- a/mul.c
+++ b/mul.c
@@ -359,7 +359,8 @@ mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
n = MPFR_LIMB_SIZE (a) + 1;
n = MIN (n, cn);
MPFR_ASSERTD (n >= 1 && 2*n <= k && n <= cn && n <= bn);
- p = n*BITS_PER_MP_LIMB - MPFR_INT_CEIL_LOG2 (n + 2) ;
+ p = n*BITS_PER_MP_LIMB
+ - MPFR_INT_CEIL_LOG2 (MPFR_INT_CEIL_LOG2 (n + 2)) -1;
bp = MPFR_MANT (b) + bn - n;
cp = MPFR_MANT (c) + cn - n;
/* Check if MulHigh can produce a roundable result.
@@ -393,7 +394,8 @@ 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);
+ p = n*BITS_PER_MP_LIMB
+ - MPFR_INT_CEIL_LOG2 (MPFR_INT_CEIL_LOG2 (n + 2)) - 1;
MPFR_ASSERTD (MPFR_PREC (a) <= p - 5);
if (MPFR_LIKELY (k < 2*n))
{