summaryrefslogtreecommitdiff
path: root/src/strtofr.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2018-04-10 12:34:44 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2018-04-10 12:34:44 +0000
commit025c0ea7235c4d0f8c7e3af28dbc5ccd5e7c1a6e (patch)
treee31ff0fd2d169123478299d16065300eb41984cf /src/strtofr.c
parent9f73397e524e396eae58b6e285ac0447a7d9fb84 (diff)
downloadmpfr-025c0ea7235c4d0f8c7e3af28dbc5ccd5e7c1a6e.tar.gz
[src/strtofr.c] added more comments
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12570 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/strtofr.c')
-rw-r--r--src/strtofr.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/strtofr.c b/src/strtofr.c
index 2e8c941e2..a7b2aaeaa 100644
--- a/src/strtofr.c
+++ b/src/strtofr.c
@@ -692,7 +692,14 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd)
and 3^2112009130072406892/B^52303988630398057 is about
1 + 2^-56.83. The worst case for bases <= 62 is b=31,
for which 31^511170973314085831/B^39569396093273623 is
- about 1 + 2^-60.27. In no case we get a carry. */
+ about 1 + 2^-60.27. In no case we get a carry.
+ More precisely, if b^e < B^E, where E = round(e*log(b)/log(B))
+ then no carry can happen, since mpfr_mpn_exp computes an
+ approximation of b^e rounded toward zero, and the closest
+ one to a power of B is with a multiplier 1 +/- 2^-60.27,
+ which also holds for the approximation toward zero, thus the
+ upper limb of {z, ysize} cannot be B-1, thus no carry can
+ happen. */
MPFR_ASSERTN(cy == 0);
}
exact = exact && (err == -1);