diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-04-27 07:40:21 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-04-27 07:40:21 +0000 |
commit | 2e38d10385696f5e5a5ef7bb5c809c7ec83a7ab6 (patch) | |
tree | b0d22a3db0a9427e9dc36dc312232bc999c83483 /src/strtofr.c | |
parent | 203b3dd9d6d35d58ea6383b41a0992ddbb30976e (diff) | |
download | mpfr-2e38d10385696f5e5a5ef7bb5c809c7ec83a7ab6.tar.gz |
[src/strtofr.c] Added/clarified comments.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12682 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/strtofr.c')
-rw-r--r-- | src/strtofr.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/strtofr.c b/src/strtofr.c index b00389bcb..306800112 100644 --- a/src/strtofr.c +++ b/src/strtofr.c @@ -681,8 +681,11 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) if (h >= ysize) /* not enough precision in z */ goto next_loop; + /* Modify z to get the upper bound. */ cy = mpn_add_1 (z + h, z + h, ysize - h, MPFR_LIMB_ONE << l); - if (cy != 0) /* the code below requires z on ysize limbs */ + /* A nonzero carry (cy != 0) means this upper bound does not + fit on ysize limbs, required by the code below. */ + if (cy != 0) /* not enough precision in z for this code */ goto next_loop; } exact = exact && (err == -1); @@ -691,8 +694,9 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) if (err == -1) err = 0; - /* compute y / z */ - /* result will be put into result + n, and remainder into result */ + /* Compute the integer division y/z rounded toward zero. + The quotient will be put at result + ysize (size: ysize + 1), + and the remainder at result (size: ysize). */ mpn_tdiv_qr (result + ysize, result, (mp_size_t) 0, y, 2 * ysize, z, ysize); |