This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix nextafter overflow in non-default rounding modes (bug 16677)
- From: Andreas Jaeger <aj at suse dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>, libc-alpha at sourceware dot org
- Date: Tue, 11 Mar 2014 22:21:33 +0100
- Subject: Re: Fix nextafter overflow in non-default rounding modes (bug 16677)
- Authentication-results: sourceware.org; auth=none
- References: <Pine dot LNX dot 4 dot 64 dot 1403112058540 dot 23789 at digraph dot polyomino dot org dot uk>
On 03/11/2014 09:59 PM, Joseph S. Myers wrote:
> ISO C requires the result of nextafter to be independent of the
> rounding mode, even when underflow or overflow occurs. This patch
> fixes the bug in various nextafter implementations that, having done
> an overflowing computation to force an overflow exception (correct),
> they then return the result of that computation rather than an
> infinity computed some other way (incorrect, when the overflowing
> result of arithmetic with that sign and rounding mode is finite but
> the correct result is infinite) - generally by falling through to
> existing code to return a value that in fact is correct for this case
> (but was computed by an integer increment and so without generating
> the exceptions required). Having fixed the bug, the previously
> deferred conversion of nextafter testing in libm-test.inc to
> ALL_RM_TEST is also included.
Thanks,
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