diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2015-10-10 08:02:07 +0200 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2015-10-10 08:02:07 +0200 |
commit | 8cd54add9b49a9f08ae389fe54abfa35251eb7e6 (patch) | |
tree | 792ac4582f24925c6c6f8e1d30732a561d075687 | |
parent | 13a6381159116f30c72393b2a7650cb72568100e (diff) | |
download | gmp-8cd54add9b49a9f08ae389fe54abfa35251eb7e6.tar.gz |
mpf/get_str.c: Increase precision of base^e computation.
-rw-r--r-- | mpf/get_str.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mpf/get_str.c b/mpf/get_str.c index 98af03272..d5ea67e53 100644 --- a/mpf/get_str.c +++ b/mpf/get_str.c @@ -204,10 +204,10 @@ mpf_get_str (char *dbuf, mp_exp_t *exp, int base, size_t n_digits, mpf_srcptr u) up += un - n_limbs_needed; un = n_limbs_needed; } - pp = TMP_ALLOC_LIMBS (2 * n_limbs_needed + 2); - tp = TMP_ALLOC_LIMBS (2 * n_limbs_needed + 2); + pp = TMP_ALLOC_LIMBS (2 * n_limbs_needed + 4); + tp = TMP_ALLOC_LIMBS (2 * n_limbs_needed + 4); - pn = mpn_pow_1_highpart (pp, &ign, (mp_limb_t) base, e, n_limbs_needed, tp); + pn = mpn_pow_1_highpart (pp, &ign, (mp_limb_t) base, e, n_limbs_needed + 1, tp); if (un > pn) mpn_mul (tp, up, un, pp, pn); /* FIXME: mpn_mul_highpart */ else @@ -241,10 +241,10 @@ mpf_get_str (char *dbuf, mp_exp_t *exp, int base, size_t n_digits, mpf_srcptr u) up += un - n_limbs_needed; un = n_limbs_needed; } - pp = TMP_ALLOC_LIMBS (2 * n_limbs_needed + 2); - tp = TMP_ALLOC_LIMBS (2 * n_limbs_needed + 2); + pp = TMP_ALLOC_LIMBS (2 * n_limbs_needed + 4); + tp = TMP_ALLOC_LIMBS (2 * n_limbs_needed + 4); - pn = mpn_pow_1_highpart (pp, &ign, (mp_limb_t) base, e, n_limbs_needed, tp); + pn = mpn_pow_1_highpart (pp, &ign, (mp_limb_t) base, e, n_limbs_needed + 1, tp); xn = n_limbs_needed + (n_less_limbs_needed-ign); xp = TMP_ALLOC_LIMBS (xn); |