diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-07-03 19:10:33 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-07-03 19:10:33 +0000 |
commit | 1e1a3c32cd8d8fc0a50ea2f1efd2b4f478fd774d (patch) | |
tree | eb874fcd4133ceddbd285c2a164a268392d0be2d /lngamma.c | |
parent | 7acfefe1884bce32d27aeb3272bc169fb066fbfa (diff) | |
download | mpfr-1e1a3c32cd8d8fc0a50ea2f1efd2b4f478fd774d.tar.gz |
fixed bug in tlgamma and added test (need to implement Ziv's strategy in
tiny case)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4625 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'lngamma.c')
-rw-r--r-- | lngamma.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -610,9 +610,12 @@ mpfr_lgamma (mpfr_ptr y, int *signp, mpfr_srcptr x, mp_rnd_t rnd) { mpfr_t l, h; int ok, inex2; - - mpfr_init2 (l, MPFR_PREC(y) + 14); - mpfr_init2 (h, MPFR_PREC(y) + 14); + mp_prec_t w = MPFR_PREC(y) + 14; + + while (1) + { + mpfr_init2 (l, w); + mpfr_init2 (h, w); /* we want a lower bound on -log(-x), thus an upper bound on log(-x), thus an upper bound on -x. */ mpfr_neg (l, x, GMP_RNDU); /* upper bound on -x */ @@ -636,6 +639,8 @@ mpfr_lgamma (mpfr_ptr y, int *signp, mpfr_srcptr x, mp_rnd_t rnd) mpfr_clear (h); if (ok) return inex; + w += MPFR_INT_CEIL_LOG2 (w) + 3; + } } } |