summaryrefslogtreecommitdiff
path: root/cos.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-01-28 13:49:30 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-01-28 13:49:30 +0000
commite733d7342a674df550e1b644e4cc3c55c4d4280b (patch)
tree1f21f4cf84021d6e7b82a298176f497cfcf2e91d /cos.c
parenta9f5bd9e9b5166a530e052837b82734c4b0fd528 (diff)
downloadmpfr-e733d7342a674df550e1b644e4cc3c55c4d4280b.tar.gz
Clean up code (due to mix with Paul changes).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3240 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'cos.c')
-rw-r--r--cos.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/cos.c b/cos.c
index 85c088bce..af0fcded4 100644
--- a/cos.c
+++ b/cos.c
@@ -135,9 +135,10 @@ mpfr_cos (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
precy + (rnd_mode == GMP_RNDN))))
break;
- if (exps == 1) /* s = 1 or -1, and except x=0 which was
- already checked above, cos(x) cannot
- be 1 or -1, so we can round */
+ if (MPFR_UNLIKELY (exps == 1))
+ /* s = 1 or -1, and except x=0 which was
+ already checked above, cos(x) cannot
+ be 1 or -1, so we can round */
{
if (exps + m - k > precy + (rnd_mode == GMP_RNDN))
/* if round to nearest or away, result is s,
@@ -161,18 +162,10 @@ mpfr_cos (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
}
m += BITS_PER_MP_LIMB;
-#if 1
- /* If cos(x) ~1 or cos(x)~ -1, then we have an huge cancelation.
- Needs to increase the precision very much */
- if (MPFR_GET_EXP (s) == 1
- && MPFR_MANT (s)[MPFR_LIMB_SIZE (s)-1] == MPFR_LIMB_HIGHBIT)
- m = 2*m;
-#else
/* if we already had two failures, possibly a huge cancellation,
for example cos(Pi) */
if (loops >= 2)
m += m / 2;
-#endif
sm = (m + BITS_PER_MP_LIMB - 1) / BITS_PER_MP_LIMB;
MPFR_TMP_INIT(rp, r, m, sm);
MPFR_TMP_INIT(sp, s, m, sm);