diff options
author | tege <tege@gmplib.org> | 1996-10-18 10:50:01 +0200 |
---|---|---|
committer | tege <tege@gmplib.org> | 1996-10-18 10:50:01 +0200 |
commit | ec204518da3a8d052c8bfb8f6a0ca5c15d1e56a1 (patch) | |
tree | 5f29f426b9f011ca167896dbd0d8ccce2dbdc8d9 | |
parent | c3d4e596048c8f43d0d5bfcaad3d88b4d3cbe8b4 (diff) | |
download | gmp-ec204518da3a8d052c8bfb8f6a0ca5c15d1e56a1.tar.gz |
Compute exp_in_base using `double' to avoid overflow.
-rw-r--r-- | mpf/get_str.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mpf/get_str.c b/mpf/get_str.c index 46ee0dca7..43113a1b4 100644 --- a/mpf/get_str.c +++ b/mpf/get_str.c @@ -146,7 +146,7 @@ mpf_get_str (digit_ptr, exp, base, n_digits, u) #endif count_leading_zeros (cnt, up[usize - 1]); - exp_in_base = ((uexp * BITS_PER_MP_LIMB - cnt) + exp_in_base = (((double) uexp * BITS_PER_MP_LIMB - cnt) * __mp_bases[base].chars_per_bit_exactly); exp_in_base += 1; @@ -249,7 +249,7 @@ mpf_get_str (digit_ptr, exp, base, n_digits, u) uexp = -uexp; count_leading_zeros (cnt, up[usize - 1]); - exp_in_base = ((uexp * BITS_PER_MP_LIMB + cnt - 1) + exp_in_base = (((double) uexp * BITS_PER_MP_LIMB + cnt - 1) * __mp_bases[base].chars_per_bit_exactly); if (exp_in_base < 0) exp_in_base = 0; |