summaryrefslogtreecommitdiff
path: root/src/eint.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2016-02-09 13:35:39 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2016-02-09 13:35:39 +0000
commit7606e4dbd06d2d7bcd95b1a99cb03a4fe810aeca (patch)
tree46adc8a8a97641ae72c54ff97391b967064766e1 /src/eint.c
parent06264e7571d13a12f4b6de11f41980abe8f1eb19 (diff)
downloadmpfr-7606e4dbd06d2d7bcd95b1a99cb03a4fe810aeca.tar.gz
now mpfr_eint() returns -E1(-x) for x < 0
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10010 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/eint.c')
-rw-r--r--src/eint.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/eint.c b/src/eint.c
index 02f1f3b39..13b4e7d5c 100644
--- a/src/eint.c
+++ b/src/eint.c
@@ -195,7 +195,8 @@ mpfr_eint_asympt (mpfr_ptr y, mpfr_srcptr x)
return err_exp;
}
-/* mpfr_eint returns Ei(x) for x >= 0, and E1(-x) for x < 0 */
+/* mpfr_eint returns Ei(x) for x >= 0,
+ and -E1(-x) for x < 0, following http://dlmf.nist.gov/6.2 */
int
mpfr_eint (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
{
@@ -219,12 +220,17 @@ mpfr_eint (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
}
else if (MPFR_IS_INF (x))
{
- /* eint(+inf) = +inf and eint(-inf) = +0 */
+ /* eint(+inf) = +inf and eint(-inf) = -0 */
if (MPFR_IS_POS (x))
- MPFR_SET_INF(y);
+ {
+ MPFR_SET_INF(y);
+ MPFR_SET_POS(y);
+ }
else
- MPFR_SET_ZERO(y);
- MPFR_SET_POS(y);
+ {
+ MPFR_SET_ZERO(y);
+ MPFR_SET_NEG(y);
+ }
MPFR_RET(0);
}
else /* eint(+/-0) = -Inf */
@@ -276,7 +282,7 @@ mpfr_eint (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
mpfr_clear (tmp);
mpfr_clear (ump);
MPFR_SAVE_EXPO_FREE (expo);
- return mpfr_underflow (y, rnd, 1);
+ return mpfr_underflow (y, rnd, -1);
}
}
@@ -342,7 +348,7 @@ mpfr_eint (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
MPFR_ZIV_FREE (loop); /* Free the ZivLoop Controller */
/* Set y to the computed value */
- inex = mpfr_set4 (y, tmp, rnd, MPFR_SIGN (x) * MPFR_SIGN (tmp));
+ inex = mpfr_set (y, tmp, rnd);
mpfr_clear (tmp);
mpfr_clear (ump);