summaryrefslogtreecommitdiff
path: root/sin.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-05-13 11:41:39 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-05-13 11:41:39 +0000
commit5b028b20d51c6229fd5f9eeed94ee953032d35cf (patch)
tree3c1189b5042997b8753b191f12b57ed3814d137e /sin.c
parentf621c4664ae6c2fd29da01cd6b39ee6d1efc3f56 (diff)
downloadmpfr-5b028b20d51c6229fd5f9eeed94ee953032d35cf.tar.gz
Add support for FAST_COMPUTE_IS_SMALL_INPUT.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3552 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'sin.c')
-rw-r--r--sin.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sin.c b/sin.c
index b3c40322c..47e3b7842 100644
--- a/sin.c
+++ b/sin.c
@@ -128,11 +128,14 @@ mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
}
}
+ /* sin(x) = x - x^3/6 + ... so the error is < 2^(3*EXP(x)-2) */
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, x, -2*MPFR_GET_EXP (x)+2,0,rnd_mode, );
+
/* Compute initial precision */
precy = MPFR_PREC (y);
m = precy + MPFR_INT_CEIL_LOG2 (precy) + 13;
e = MPFR_GET_EXP (x);
- m += (e < 0) ? -2*e : e;
+ m += (e < 0) ? -2*e : e;
sign = mpfr_sin_sign (x);
mpfr_init2 (c, m);