summaryrefslogtreecommitdiff
path: root/eint.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-06-10 15:05:54 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-06-10 15:05:54 +0000
commit438059ac5a74343c5eb047e0fd0a335b19f62730 (patch)
tree2ce092f9f23f39d86316202d67173bf85981876d /eint.c
parent4bdee2496cb5a52cb18e54cf3b02f4a86763b594 (diff)
downloadmpfr-438059ac5a74343c5eb047e0fd0a335b19f62730.tar.gz
Fix bug: check if mpfr_log returns 0.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3641 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'eint.c')
-rw-r--r--eint.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/eint.c b/eint.c
index 0b8d062ac..b1b1f2087 100644
--- a/eint.c
+++ b/eint.c
@@ -217,8 +217,10 @@ mpfr_eint (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd)
mpfr_log (ump, x, GMP_RNDN);
mpfr_add (tmp, tmp, ump, GMP_RNDN);
/* same formula as above, except now EXP(ump) is not 0 */
- err = MAX(0, 1 + MAX (MPFR_GET_EXP (ump), te + err + 1)
- - MPFR_GET_EXP (tmp));
+ err += te + 1;
+ if (MPFR_LIKELY (!MPFR_IS_ZERO (ump)))
+ err = MAX (MPFR_GET_EXP (ump), err);
+ err = MAX(0, err - MPFR_GET_EXP (tmp));
err = MPFR_PREC (tmp) - err;
if (MPFR_LIKELY (MPFR_CAN_ROUND (tmp, err, MPFR_PREC (y), rnd)))
break;