diff options
author | tege <tege@gmplib.org> | 2000-07-31 01:38:16 +0200 |
---|---|---|
committer | tege <tege@gmplib.org> | 2000-07-31 01:38:16 +0200 |
commit | 7a74ec529bcedc242fd4f776f959d26365d327c0 (patch) | |
tree | dd148da07ffbb005b8e01d7f026b130bce0b082e | |
parent | 76739da319ed6b2456b9e979e95289facbc81b52 (diff) | |
download | gmp-7a74ec529bcedc242fd4f776f959d26365d327c0.tar.gz |
Develop three extra digits, not just one.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | mpf/get_str.c | 11 |
2 files changed, 14 insertions, 5 deletions
@@ -1,3 +1,7 @@ +2000-07-31 Torbjorn Granlund <tege@swox.com> + + * mpf/get_str.c: Develop three extra digits, not just one. + 2000-07-31 Kevin Ryde <kevin@swox.se> * gmp.texi (References): Add URL for invariant division. @@ -56,7 +60,7 @@ New functions. (numberof, TMP_ALLOC_TYPE etc, _MP_ALLOCATE_FUNC_TYPE etc, UNSIGNED_TYPE_MAX etc): New macros. - + * tune/*: Add FFT threshold tuning and speed measuring. * tune/common.c: Avoid huge macro expansions for umul and udiv. @@ -99,7 +103,7 @@ * configure.in: Add sparc64-*-linux* support (from Jakub Jelinek). * configure: Regenerate. - + * mpn/sparc64/rshift.asm: Use %g5 instead of volatile stack frame area for return value (from Jakub Jelinek). * mpn/sparc64/lshift.asm: Likewise. diff --git a/mpf/get_str.c b/mpf/get_str.c index a2c53a35d..a9c6551ce 100644 --- a/mpf/get_str.c +++ b/mpf/get_str.c @@ -317,13 +317,18 @@ mpf_get_str (digit_ptr, exp, base, n_digits, u) /* fall out to general code... */ } + /* Now that we have normalized the number, develop the digits, essentially by + multiplying it by BASE. We initially develop at least 3 extra digits, + since the two leading digits might become zero, and we need one extra for + rounding the output properly. */ + /* Allocate temporary digit space. We can't put digits directly in the user area, since we generate more digits than requested. (We allocate - BITS_PER_MP_LIMB + 1 extra bytes because of the digit block nature of the + BITS_PER_MP_LIMB extra bytes because of the digit block nature of the conversion.) */ - tstr = (unsigned char *) TMP_ALLOC (n_digits + BITS_PER_MP_LIMB + 1); + tstr = (unsigned char *) TMP_ALLOC (n_digits + BITS_PER_MP_LIMB + 3); - for (digits_computed_so_far = 0; digits_computed_so_far <= n_digits; + for (digits_computed_so_far = 0; digits_computed_so_far < n_digits + 3; digits_computed_so_far += dig_per_u) { mp_limb_t cy; |