This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix powerpc32 lround, lroundf spurious exceptions (bug 19134) [committed]
- From: Matt Turner <mattst88 at gmail dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 14 Oct 2015 15:15:33 -0700
- Subject: Re: Fix powerpc32 lround, lroundf spurious exceptions (bug 19134) [committed]
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 10 dot 1510142114370 dot 2045 at digraph dot polyomino dot org dot uk>
On Wed, Oct 14, 2015 at 2:15 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> Committed. Any optimizations of this code anyone may wish to make are of
> course welcome.
The code seems to do the (|x| + 0.5) and round towards zero trick,
which it notes does not work for an input of nextafter(0.5, 0.0)
(i.e., 0x1.fffffffffffffp-2):
> It is necessary to detect when x is (+-)0x1.fffffffffffffp-2 because adding +-0.5 in this case will cause an erroneous shift, carry and round. We simply return 0 if 0.5 > x > -0.5.
and so it handles 0.5 > x > -0.5 specially. Can it not simply add
0x1.fffffffffffffp-2 instead of 0.5 and remove the special case?