diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-03-05 09:29:42 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-03-05 09:29:42 +0000 |
commit | cb8d50ed5d6c446f4bc15e065649ddedd5d353be (patch) | |
tree | 59e7a8e7891d195c8e1c67c67b6f3eccfd968d74 /src/get_str.c | |
parent | 4b7bdecb6034aec32f8593ad7c97fd459230c50d (diff) | |
download | mpfr-cb8d50ed5d6c446f4bc15e065649ddedd5d353be.tar.gz |
[src/get_str.c] fixed FIXME
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12456 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/get_str.c')
-rw-r--r-- | src/get_str.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/get_str.c b/src/get_str.c index 215874fbe..ee9e0667c 100644 --- a/src/get_str.c +++ b/src/get_str.c @@ -2265,9 +2265,10 @@ mpfr_get_str_digits (int b, mpfr_prec_t p) return 2 + (p - 2) / k; } - /* FIXME: The condition p >= 186564318007 might not be true. Does - this matter? */ - /* now p >= 186564318007 and b is not a power of two */ + /* Now p is large and b is not a power of two. The code below works for any + value of p and b, as long as b is not a power of two. Indeed, in such a + case, p*log(2)/log(b) cannot be exactly an integer, and thus Ziv's loop + will terminate. */ { mpfr_prec_t w = 77; /* mpfr_ceil_mul used a 77-bit upper approximation of log(2)/log(b) */ @@ -2282,7 +2283,7 @@ mpfr_get_str_digits (int b, mpfr_prec_t p) mpfr_set_ui (u, b, MPFR_RNDD); mpfr_log2 (d, d, MPFR_RNDU); mpfr_log2 (u, u, MPFR_RNDD); - /* u <= log(b)/log(2) <= d */ + /* u <= log(b)/log(2) <= d (***) */ if (MPFR_LIKELY (p <= ULONG_MAX)) { mpfr_ui_div (d, p, d, MPFR_RNDD); |