diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2008-11-22 15:49:07 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2008-11-22 15:49:07 +0000 |
commit | 71f5e9220ed8e375d4f66b479772fddccd6956b6 (patch) | |
tree | aabeceaa34acbaac67dbe1bda9a5aeca15d7894f /cos.c | |
parent | 44e889c6280d7080baecfb55d39224e98552e9f5 (diff) | |
download | mpfr-71f5e9220ed8e375d4f66b479772fddccd6956b6.tar.gz |
r5689 undone: some casts were incorrect (mp_exp_t may be greater than
mp_prec_t, so that casting a mp_exp_t into a mp_prec_t can introduce a
bug). There may be bugs in some cases, but the casts fix the symptom,
not the bug (unless one casts the unsigned type to a signed type that
is *strictly* larger, which is not possible here).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5690 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'cos.c')
-rw-r--r-- | cos.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -70,7 +70,7 @@ mpfr_cos2_aux (mpfr_ptr f, mpfr_srcptr r) mpz_set_ui (s, 1); /* initialize sum with 1 */ mpz_mul_2exp (s, s, p + q); /* scale all values by 2^(p+q) */ mpz_set (t, s); /* invariant: t is previous term */ - for (i = 1; (mp_prec_t) (m = mpz_sizeinbase (t, 2)) >= q; i += 2) + for (i = 1; (m = mpz_sizeinbase (t, 2)) >= q; i += 2) { /* adjust precision of x to that of t */ l = mpz_sizeinbase (x, 2); @@ -114,7 +114,7 @@ mpfr_cos2_aux (mpfr_ptr f, mpfr_srcptr r) mpz_clear (t); l = (i - 1) / 2; /* number of iterations */ - return 2 * MPFR_INT_CEIL_LOG2 ((mp_prec_t) l + 1) + 1; /* bound is 2l(l+1) */ + return 2 * MPFR_INT_CEIL_LOG2 (l + 1) + 1; /* bound is 2l(l+1) */ } int |