diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-02-16 10:52:40 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-02-16 10:52:40 +0000 |
commit | c12776d90274a193b746855ef5094613a49100f4 (patch) | |
tree | bd972eb324b9184776a1aeb4762c7a227c132c8d /agm.c | |
parent | 44ccfdf282bc578fbaf4bd866dc0db41184d08a4 (diff) | |
download | mpfr-c12776d90274a193b746855ef5094613a49100f4.tar.gz |
Commented out the now useless "double uo, vo;".
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2716 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'agm.c')
-rw-r--r-- | agm.c | 46 |
1 files changed, 24 insertions, 22 deletions
@@ -26,7 +26,9 @@ mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mp_rnd_t rnd_mode) { int s, go_on, compare, inexact; mp_prec_t p, q; +#if 0 double uo, vo; +#endif mp_limb_t *up, *vp, *tmpp, *tmpup, *tmpvp, *ap, *bp; mpfr_t u, v, tmp, tmpu, tmpv, a, b; TMP_DECL(marker); @@ -73,13 +75,13 @@ mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mp_rnd_t rnd_mode) /* Initialisations */ go_on = 1; - + TMP_MARK(marker); s = (p - 1) / BITS_PER_MP_LIMB + 1; - MPFR_TMP_INIT(ap, a, p, s); + MPFR_TMP_INIT(ap, a, p, s); MPFR_TMP_INIT(bp, b, p, s); MPFR_TMP_INIT(up, u, p, s); - MPFR_TMP_INIT(vp, v, p, s); + MPFR_TMP_INIT(vp, v, p, s); MPFR_TMP_INIT(tmpup, tmpu, p, s); MPFR_TMP_INIT(tmpvp, tmpv, p, s); MPFR_TMP_INIT(tmpp, tmp, p, s); @@ -88,7 +90,7 @@ mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mp_rnd_t rnd_mode) if ((compare = mpfr_cmp (op1, op2)) > 0) { mpfr_set (b,op1,GMP_RNDN); - mpfr_set (a,op2,GMP_RNDN); + mpfr_set (a,op2,GMP_RNDN); } else if (compare == 0) { @@ -99,10 +101,10 @@ mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mp_rnd_t rnd_mode) else { mpfr_set (b, op2, GMP_RNDN); - mpfr_set (a, op1, GMP_RNDN); + mpfr_set (a, op1, GMP_RNDN); } -#if 0 +#if 0 vo = mpfr_get_d1 (b); uo = mpfr_get_d1 (a); #endif @@ -117,10 +119,10 @@ mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mp_rnd_t rnd_mode) mp_prec_t eq; double erraux; -#if 0 - erraux = (vo == uo) ? 0.0 +#if 0 + erraux = (vo == uo) ? 0.0 : __gmpfr_ceil_exp2 (-2.0 * (double) p * uo / (vo - uo)); - err = 1 + (int) ((3.0 / 2.0 * (double) __gmpfr_ceil_log2 ((double) p) + err = 1 + (int) ((3.0 / 2.0 * (double) __gmpfr_ceil_log2 ((double) p) + 1.0) * __gmpfr_ceil_exp2 (- (double) p) + 3.0 * erraux); #else @@ -146,19 +148,19 @@ mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mp_rnd_t rnd_mode) /* Calculus of un and vn */ do { - mpfr_mul(tmp, u, v, GMP_RNDN); - mpfr_sqrt (tmpu, tmp, GMP_RNDN); - mpfr_add(tmp, u, v, GMP_RNDN); - mpfr_div_2ui(tmpv, tmp, 1, GMP_RNDN); - mpfr_set(u, tmpu, GMP_RNDN); - mpfr_set(v, tmpv, GMP_RNDN); + mpfr_mul (tmp, u, v, GMP_RNDN); + mpfr_sqrt (tmpu, tmp, GMP_RNDN); + mpfr_add (tmp, u, v, GMP_RNDN); + mpfr_div_2ui (tmpv, tmp, 1, GMP_RNDN); + mpfr_set (u, tmpu, GMP_RNDN); + mpfr_set (v, tmpv, GMP_RNDN); } while (mpfr_cmp2 (u, v, &eq) != 0 && eq <= p - 2); /* Roundability of the result */ - can_round = mpfr_can_round (v, p - err - 3, GMP_RNDN, GMP_RNDZ, + can_round = mpfr_can_round (v, p - err - 3, GMP_RNDN, GMP_RNDZ, q + (rnd_mode == GMP_RNDN)); - + if (can_round) go_on = 0; @@ -167,9 +169,9 @@ mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mp_rnd_t rnd_mode) p += 5; s = (p - 1) / BITS_PER_MP_LIMB + 1; MPFR_TMP_INIT(up, u, p, s); - MPFR_TMP_INIT(vp, v, p, s); - MPFR_TMP_INIT(tmpup, tmpu, p, s); - MPFR_TMP_INIT(tmpvp, tmpv, p, s); + MPFR_TMP_INIT(vp, v, p, s); + MPFR_TMP_INIT(tmpup, tmpu, p, s); + MPFR_TMP_INIT(tmpvp, tmpv, p, s); MPFR_TMP_INIT(tmpp, tmp, p, s); mpfr_set (u, a, GMP_RNDN); mpfr_set (v, b, GMP_RNDN); @@ -182,13 +184,13 @@ mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mp_rnd_t rnd_mode) inexact = mpfr_set (r, v, rnd_mode); /* Let's clean */ - TMP_FREE(marker); + TMP_FREE(marker); return inexact; /* agm(u,v) can be exact for u, v rational only for u=v. Proof (due to Nicolas Brisebarre): it suffices to consider u=1 and v<1. Then 1/AGM(1,v) = 2F1(1/2,1/2,1;1-v^2), and a theorem due to G.V. Chudnovsky states that for x a - non-zero algebraic number with |x|<1, then + non-zero algebraic number with |x|<1, then 2F1(1/2,1/2,1;x) and 2F1(-1/2,1/2,1;x) are algebraically independent over Q. */ } |