y0/y1/yn and exceptions - GCC 3.4 changes
Andreas Jaeger
aj@suse.de
Sat Dec 20 08:11:00 GMT 2003
Roger Sayle <roger@eyesopen.com> writes:
> On Fri, 19 Dec 2003, Andreas Jaeger wrote:
>> I analyzed the y0 (0.0) failure for double:
>>
>> In e_j0.c we check for y0(0.0) with:
>> if((ix|lx)==0) return -one/zero;
>>
>> Previously GCC evaluated this at compiletime and generated a NaN but
>> since this was done at compile-time, no exception was set at run-time
>>
>> Now GCC does the calculation at run-time and sets the exception
>> (Roger, is this correct? I remember you doing work in this area).
>>
>> What do you think? Is GCC correct and we should change glibc? In
>> that case I'll make the changes to the math testsuite.
>
> Hi Andreas,
>
> Indeed the change was made to GCC to not evaluate floating point
> division by zero in in-line code at compile-time, precisely to allow
> the observable floating point exception to be raised if that division
> ever gets executed.
>
> The solution, given that this code is supposed to return a constant,
> is to change the glibc source code such that the division is performed
> in the initializer of a global or static variable. In these cases, the
> division by zero, and conversion into +-Inf or NaN is performed at
> compile-time. This is the idiom used by many of the testcases in
> gcc.c-torture/execute/ieee that needs such non-finite values.
I'm not sure what's the correct thing is for glibc, the standards do
not mention the behaviour of y0/y1/yn AFAIK. So, how shall we update
glibc?
Thanks for the information,
Andreas
--
Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
SuSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20031220/5bdadead/attachment.sig>
More information about the Libc-alpha
mailing list