summaryrefslogtreecommitdiff
path: root/sin.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2007-05-28 00:27:16 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2007-05-28 00:27:16 +0000
commit5c24b31fcbc7fb09d383548121b5157642de489e (patch)
tree7dc70b37eb9c08ba96b8b2f979275ecf16c1a70f /sin.c
parentf380ece2680461570e1ce03956ebb173b63052f6 (diff)
downloadmpfr-5c24b31fcbc7fb09d383548121b5157642de489e.tar.gz
Avoid integer overflow in MPFR_FAST_COMPUTE_IF_SMALL_INPUT.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4468 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'sin.c')
-rw-r--r--sin.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sin.c b/sin.c
index e44d215cb..90aa13c36 100644
--- a/sin.c
+++ b/sin.c
@@ -130,12 +130,8 @@ 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) */
- /* FIXME: we replaced -2*MPFR_GET_EXP (x)+2 by -2*MPFR_GET_EXP (x)+1,
- which is still a valid bound, but looses one bit, to overcome the
- problem when MPFR_GET_EXP(x)=-2^(w-2)+1 on a w-bit machine: then
- -2*MPFR_GET_EXP (x)+2 = 2^(w-1) overflows. When this problem is
- fixed in MPFR_FAST_COMPUTE_IF_SMALL_INPUT, replace 1 by 2. */
- MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, x, -2*MPFR_GET_EXP (x)+1,0,rnd_mode,{});
+ MPFR_FAST_COMPUTE_IF_SMALL_INPUT (y, x, -2 * MPFR_GET_EXP (x), 2, 0,
+ rnd_mode, {});
/* Compute initial precision */
precy = MPFR_PREC (y);