Fix powerpc32 lround, lroundf spurious exceptions (bug 19134) [committed]
Matt Turner
mattst88@gmail.com
Wed Oct 14 22:15:00 GMT 2015
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?
More information about the Libc-alpha
mailing list