This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix powerpc32 lround, lroundf spurious exceptions (bug 19134) [committed]


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]