summaryrefslogtreecommitdiff
path: root/log1p.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-05-13 11:49:46 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-05-13 11:49:46 +0000
commit9e30b88d4035487a3a225b80ee72e9cce91fdc73 (patch)
treeaf1fdbace2bc039d2b15a91196d62c47c8a771d2 /log1p.c
parent5b028b20d51c6229fd5f9eeed94ee953032d35cf (diff)
downloadmpfr-9e30b88d4035487a3a225b80ee72e9cce91fdc73.tar.gz
Add support for MPFR_FAST_COMPUTE_IS_SMALL_INPUT
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3553 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'log1p.c')
-rw-r--r--log1p.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/log1p.c b/log1p.c
index ca98975ed..6180ef225 100644
--- a/log1p.c
+++ b/log1p.c
@@ -61,7 +61,10 @@ mpfr_log1p (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
MPFR_RET (0);
}
}
-
+
+ /* log(1+x) = x-x^2/2 + ... so the error is < 2^(2*EXP(x)-1) */
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, x, -MPFR_GET_EXP (x)+1,0,rnd_mode,);
+
comp = mpfr_cmp_si (x, -1);
/* log1p(x) is undefined for x < -1 */
if (MPFR_UNLIKELY(comp <= 0))