summaryrefslogtreecommitdiff
path: root/src/strtofr.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-04-27 15:07:18 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-04-27 15:07:18 +0000
commitbd1f1b5234011f08bda2f647cf472ea174f07aa6 (patch)
treef367baecd15975f410c2e8454bc5fd8fe6640fc3 /src/strtofr.c
parent4e5c5dbc93a6125a34ed66b4545765b6b6f330c1 (diff)
downloadmpfr-bd1f1b5234011f08bda2f647cf472ea174f07aa6.tar.gz
[src/strtofr.c] Updated TODO about potentially unnecessary code,
showing that this code probably increases the error bound (errors accumulate instead of compensating without this code). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12687 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/strtofr.c')
-rw-r--r--src/strtofr.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/strtofr.c b/src/strtofr.c
index 9c76862b0..9d11718c9 100644
--- a/src/strtofr.c
+++ b/src/strtofr.c
@@ -683,6 +683,20 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd)
/* TODO: Is this necessary? If this has an effect on the
rounded result, doesn't this mean that mpfr_round_p will
catch the error and yield a Ziv loop?
+ More precisely, after mpfr_mpn_exp, the exact value of b^e
+ is between z and z + 2^err. If one takes the upper bound
+ z + 2^err (current code), then the error will be:
+ y/b^e - trunc(y/(z + 2^err)) = eps1 + eps2
+ with
+ eps1 = y/b^e - y/(z + 2^err) >= 0
+ eps2 = y/(z + 2^err) - trunc(y/(z + 2^err)) >= 0
+ thus the errors will accumulate.
+ If one takes the lower bound z, then the error will be:
+ y/b^e - trunc(y/z) = eps1 + eps2
+ with
+ eps1 = y/b^e - y/z <= 0
+ eps2 = y/z - trunc(y/z) >= 0
+ thus the errors will (partly) compensate.
Disabling this code by adding "0 &&" in front of "err >= 0"
with r12685 does not yield any "make check" failure for both
the 32-bit and the 64-bit ABI's.