This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix math functions triggering invalid exceptions
- From: David Miller <davem at davemloft dot net>
- To: aurelien at aurel32 dot net
- Cc: libc-alpha at sources dot redhat dot com
- Date: Wed, 15 Feb 2012 14:25:15 -0500 (EST)
- Subject: Re: [PATCH] Fix math functions triggering invalid exceptions
- References: <20120215184351.GA17446@hall.aurel32.net>
From: Aurelien Jarno <aurelien@aurel32.net>
Date: Wed, 15 Feb 2012 19:43:52 +0100
> Commits bcf01e6d and 0ac5ae23 optimized math functions by, among other
> things, removing the special cases for NaN, and letting them propagate
> through the whole code. The idea seems good, given that NaN should be
> considered as the exception rather than the rule, but the floating point
> comparison operators in C are signaling operations. Thus on
> architectures using the changed code, an invalid exception is triggered
> when a mathematical function is passed a NaN. This violates the C
> specification.
>
> As a consequence, test-float, test-ifloat, test-double and test-idouble
> are failing on at least arm, mips, ia64 and sparc. Architectures like
> x86, x86-64 or s390 are not affected given they have their own
> implementation of most floating point functions.
>
> The patch below addresses the issue by using non-signaling
> floating-point comparisons, that is functions like isgreater, isless or
> isgreaterequal.
Thanks for fixing this.