summaryrefslogtreecommitdiff
path: root/eint.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2006-11-19 09:28:35 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2006-11-19 09:28:35 +0000
commitec9013f27f98d800ea052b1aac0950370a509e51 (patch)
treea4cf96f2e324cfb2dc35b10cc1a68b3f185b55a6 /eint.c
parentd3fa13f7610991de0fb820848368157c8be13a13 (diff)
downloadmpfr-ec9013f27f98d800ea052b1aac0950370a509e51.tar.gz
fixed bug in erfc (forgot to compare result of cmp_si)
fixed infinite loop in eint (test for use of asympt was not tight enough) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4233 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'eint.c')
-rw-r--r--eint.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/eint.c b/eint.c
index 9153350a6..227d196f8 100644
--- a/eint.c
+++ b/eint.c
@@ -273,7 +273,11 @@ mpfr_eint (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd)
MPFR_ZIV_INIT (loop, prec); /* Initialize the ZivLoop controler */
for (;;) /* Infinite loop */
{
- if (mpfr_cmp_d (x, (double) prec * LOG2) > 0)
+ /* We need that the smallest value of k!/x^k is smaller than 2^(-p).
+ The minimum is obtained for x=k, and it is smaller than e*sqrt(x)/e^x
+ for x>=1. */
+ if (MPFR_GET_EXP (x) > 0 && mpfr_cmp_d (x, ((double) prec +
+ 0.5 * (double) MPFR_GET_EXP (x)) * LOG2 + 1.0) > 0)
err = mpfr_eint_asympt (tmp, x);
else
{