diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-05-28 00:27:16 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-05-28 00:27:16 +0000 |
commit | 5c24b31fcbc7fb09d383548121b5157642de489e (patch) | |
tree | 7dc70b37eb9c08ba96b8b2f979275ecf16c1a70f /sin.c | |
parent | f380ece2680461570e1ce03956ebb173b63052f6 (diff) | |
download | mpfr-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.c | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -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); |