diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2020-02-29 13:07:12 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2020-02-29 13:07:12 +0000 |
commit | 64fa8d139a2315a967a935447c29de3fb6a967f8 (patch) | |
tree | 9ff7abbc7bbaa3a7c8c94c5283b8c4b2646d5133 | |
parent | 67952e02d2e47826b45fd21ea70cfacf87ff6bf0 (diff) | |
download | mpfr-64fa8d139a2315a967a935447c29de3fb6a967f8.tar.gz |
[src/sin.c] increase initial precision when x is large
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13737 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | src/sin.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -82,7 +82,9 @@ mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) goto end; } - m = precy + MPFR_INT_CEIL_LOG2 (precy) + 7; + /* for x large, since argument reduction is expensive, we want to avoid + any failure in Ziv's strategy, thus we take into account expx too */ + m = precy + MPFR_INT_CEIL_LOG2 (MAX(precy,expx)) + 7; /* since we compute sin(x) as sqrt(1-cos(x)^2), and for x small we have cos(x)^2 ~ 1 - x^2, when subtracting cos(x)^2 from 1 we will lose |