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 rintf rounding (bug 2548)


On Sun, Feb 19, 2012 at 2:52 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> Bug 2548 reports a case where rintf incorrectly rounds some values.
> This is a case of the implementation trying to be overly clever, and
> getting it wrong.
>
> Adding +-2**23 to a finite float value of the same sign and smaller
> magnitude, then subtracting it, always results in the correct value
> rounded to an integer according to the current rounding direction,
> with the correct exceptions raised, except that the sign of a zero
> result may be wrong. ?So the only bit manipulation needed in this case
> is to fix the sign of zero. ?Accordingly I propose this patch which
> removes the unnecessary code (which the test in the bug shows to be
> incorrect) and adds testcases for both the case in the bug and a range
> of similar cases (including powers of 2 plus 0.75, from 2**46 to
> 2**50, to make sure there are no similar bugs for "double").
>
> Tested on x86_64 --disable-multi-arch (without --disable-multi-arch,
> the problem won't reproduce on a system with SSE4.1 because that uses
> an appropriate hardware instruction directly).
>
> Carlos, I think this will be appropriate for 2.15 branch (and older
> branches) as a bug fix - once we've allowed time to see if the new
> tests show up bugs in any other architectures' implementations of
> these functions.

My preference is to say that backport requests like this should be
filed as bugs against 2.15 or with keyword glibc_2.15. There is no way
a release manager will be able to easily and reliabley track backports
without the help of bugzilla.

Comments?

Cheers,
Carlos.


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