summaryrefslogtreecommitdiff
path: root/src/lngamma.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2017-12-20 10:48:26 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2017-12-20 10:48:26 +0000
commitafba0f707ee32f09886c762054a0e676c8ad5b3f (patch)
treeea3e716d8697bdef0cd4f5d2a924e30d78f28c5c /src/lngamma.c
parent5a7af2e061628fdcaa1adc0a499ef954bf3f90f6 (diff)
downloadmpfr-afba0f707ee32f09886c762054a0e676c8ad5b3f.tar.gz
[src/lngamma.c] fixed bug found in previous commit
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12029 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/lngamma.c')
-rw-r--r--src/lngamma.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lngamma.c b/src/lngamma.c
index 147ef6bfc..c1ce77de9 100644
--- a/src/lngamma.c
+++ b/src/lngamma.c
@@ -397,11 +397,15 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mpfr_rnd_t rnd)
}
else
{
- err_s += 1 - MPFR_GET_EXP(v);
+ /* if v = 0 here, it was 1 before the call to mpfr_log,
+ thus the error on v was zero */
+ if (!MPFR_IS_ZERO(v))
+ err_s += 1 - MPFR_GET_EXP(v);
err_s = (err_s >= 0) ? err_s + 1 : 0;
/* the error on v is bounded by 2^err_s ulps */
err_u += MPFR_GET_EXP(u); /* absolute error on u */
- err_s += MPFR_GET_EXP(v); /* absolute error on v */
+ if (!MPFR_IS_ZERO(v)) /* same as above */
+ err_s += MPFR_GET_EXP(v); /* absolute error on v */
mpfr_sub (s, v, u, MPFR_RNDN);
/* the total error on s is bounded by ulp(s)/2 + 2^(err_u-w)
+ 2^(err_s-w) <= ulp(s)/2 + 2^(max(err_u,err_s)+1-w) */