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 Sunday, February 19, 2012 20:52:24 Joseph S. Myers 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).


The same code snippets you remove for flt-32 are alos in the dbl-64 code. 
Are they really needed in that case?

The patch itself looks fine to me,

Andreas
-- 
 Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


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