diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2015-06-10 10:47:35 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2015-06-10 10:47:35 +0000 |
commit | 7bf47d73876e0b730e0eb3e709fae5a109a9ac00 (patch) | |
tree | 41f848f650f0715d12edcca21a2b6f9de861445a /src | |
parent | 330d40de0041828ec6a20956c84e8b9f367ff217 (diff) | |
download | mpfr-7bf47d73876e0b730e0eb3e709fae5a109a9ac00.tar.gz |
[src/{cos.c,sin.c}] Fixed bug related to the exponent range, introduced
in r6461 with the use of mpfr_sincos_fast.
Details:
For mpfr_sin, the exponent range was not restored, and restoring it
before calling mpfr_sincos_fast as this was done for mpfr_cos did
not work; indeed the source of this function shows that it needs an
extended exponent range. So, changed both mpfr_cos and mpfr_sin to
call mpfr_sincos_fast in the extended exponent range and restore the
exponent range at the end, like in usual code.
(merged changeset r9542 from the trunk)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@9548 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src')
-rw-r--r-- | src/cos.c | 5 | ||||
-rw-r--r-- | src/sin.c | 6 |
2 files changed, 8 insertions, 3 deletions
@@ -169,8 +169,8 @@ mpfr_cos (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) if (precy >= MPFR_SINCOS_THRESHOLD) { - MPFR_SAVE_EXPO_FREE (expo); - return mpfr_cos_fast (y, x, rnd_mode); + inexact = mpfr_cos_fast (y, x, rnd_mode); + goto end; } K0 = __gmpfr_isqrt (precy / 3); @@ -293,6 +293,7 @@ mpfr_cos (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) mpfr_clear (c); } + end: MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (y, inexact, rnd_mode); } @@ -76,7 +76,10 @@ mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) precy = MPFR_PREC (y); if (precy >= MPFR_SINCOS_THRESHOLD) - return mpfr_sin_fast (y, x, rnd_mode); + { + inexact = mpfr_sin_fast (y, x, rnd_mode); + goto end; + } m = precy + MPFR_INT_CEIL_LOG2 (precy) + 13; expx = MPFR_GET_EXP (x); @@ -178,6 +181,7 @@ mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) mpfr_clear (c); mpfr_clear (xr); + end: MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (y, inexact, rnd_mode); } |