simon-git: spigot (master): Simon Tatham
Commits to Tartarus CVS repository.
tartarus-commits at lists.tartarus.org
Sat Mar 21 15:22:28 GMT 2015
TL;DR:
2cd1a83 Get rid of the bool return value from sign_exp().
bcadf64 More sophisticated calculation of exponent in base output.
c2b18a3 Fix identification of cross-exponent rounding boundaries.
c2fcdc3 Add some tests of roundup to overflow.
Repository: git://git.tartarus.org/simon/spigot.git
On the web: http://tartarus.org/~simon-git/gitweb/?p=spigot.git
Branch updated: master
Committer: Simon Tatham <anakin at pobox.com>
Date: 2015-03-21 15:22:28
commit 2cd1a83dc8aeb6777c899f8b0fe5cdf530b105da
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=2cd1a83dc8aeb6777c899f8b0fe5cdf530b105da;hp=c26c2ca41bf8b8c3ded106af3984b86df4274a9c
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Mar 21 15:20:16 2015 +0000
Get rid of the bool return value from sign_exp().
I've decided it wasn't the right way to handle IEEE overflow after
all, because it set the 'done' flag in the BaseOutputGenerator main
loop which then did unhelpful post-rounding processing on the
resulting formatter. Instead, formatters in the overflow state now
mark themselves as complete in a way that's _separate_ from that
'done' flag, and not checked by anything except the code that checks
the final termination condition.
I'd reused the same flag for %f formatting of exponents smaller than
the precision, which was lazy; that's obviously better done with the
same min_exp mechanism that BaseFormatter uses. Added some test cases
that failed before.
baseout.cpp | 55 +++++++++++++++++++++++++++++--------------------------
test.sh | 3 +++
2 files changed, 32 insertions(+), 26 deletions(-)
commit bcadf64be056da1ff0d95492c7cbeb861446c9b4
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=bcadf64be056da1ff0d95492c7cbeb861446c9b4;hp=2cd1a83dc8aeb6777c899f8b0fe5cdf530b105da
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Mar 21 15:21:08 2015 +0000
More sophisticated calculation of exponent in base output.
The previous approach of just taking floor_log of the integer at the
end of an interval was not quite robust, because some of those
interval-end integers are implicitly 'plus or minus epsilon', and the
minus-epsilon case can make a difference. Also, terminating the
exponent-finding loop once the two ends of the interval differ by less
than a factor of ebase turned out to be not quite robust: in cases
where it's possible to round up to the next exponent and the rules for
doing so can change depending on exponent, it was occasionally
possible to find a case which finished the exponent loop with a range
of three rather than two possible exponents.
So instead, we now have a more rigorous function for computing an
exponent from an integer plus an 'is this exact' flag, and we
terminate the exponent loop once the two ends of the interval yield
return values from that function differing by at most one.
In the course of this, I've also factored out the translation of
user-provided rounding modes into non-sign-dependent ones (e.g. 'round
up' becomes either round toward zero or round toward infinity once the
sign is known), since it now has to be called during the tentative
exponent calculation as well as once the exponent loop actually
terminates.
baseout.cpp | 124 ++++++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 102 insertions(+), 22 deletions(-)
commit c2b18a350865ad3126487bcee05061ed7cce411d
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=c2b18a350865ad3126487bcee05061ed7cce411d;hp=bcadf64be056da1ff0d95492c7cbeb861446c9b4
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Mar 21 15:21:27 2015 +0000
Fix identification of cross-exponent rounding boundaries.
In cases near an exponent boundary, where we're simultaneously running
two formatters with different exponents, the formatter for the higher
exponent typically miscomputes the low end of its catchment interval.
(Because that computation is based on _its_ idea of the distance
between representable outputs, and in case of a disagreement the lower
formatter's idea is right. IEEE round-up is an example of this.)
So I've now arranged that we notice that situation, and when we see
it, the upper formatter discards its own idea of the rounding boundary
and defers to the lower's one.
baseout.cpp | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 105 insertions(+), 15 deletions(-)
commit c2fcdc3adad33fd54718d7b3ee7cc42c595e52ed
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=c2fcdc3adad33fd54718d7b3ee7cc42c595e52ed;hp=c2b18a350865ad3126487bcee05061ed7cce411d
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Mar 21 15:21:41 2015 +0000
Add some tests of roundup to overflow.
These tests pass as a result of the previous commits.
test.sh | 8 ++++++++
1 file changed, 8 insertions(+)
More information about the tartarus-commits
mailing list