diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-05-23 18:33:35 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-05-23 18:33:35 +0000 |
commit | 3acd54d13e370a86496faa45e90620b549e638be (patch) | |
tree | f817f7433f9b84d7ee98219d3abb4d542d74a599 /sin.c | |
parent | ce0cbf91bbf51b2c8bbe2a7704d5373be8b916e7 (diff) | |
download | mpfr-3acd54d13e370a86496faa45e90620b549e638be.tar.gz |
workaround for bug when x is very small (check_tiny in tsin)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4462 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'sin.c')
-rw-r--r-- | sin.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -130,7 +130,12 @@ 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,{}); + /* 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,{}); /* Compute initial precision */ precy = MPFR_PREC (y); |