This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH RFC] <math.h> issignaling
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Thomas Schwinge <thomas at codesourcery dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Wed, 6 Mar 2013 18:13:54 +0000
- Subject: Re: [PATCH RFC] <math.h> issignaling
- References: <8762148l9v.fsf@schwinge.name>
On Wed, 6 Mar 2013, Thomas Schwinge wrote:
> Currently I'm providing a __issignalingl symbol (aliased to
> __issignaling) if NO_LONG_DOUBLE is defined. The <math.h> issignaling
> macro definition on the other hand adds long double support based on
> __NO_LONG_DOUBLE_MATH being defined. I don't completely understand yet
> what exactly each of NO_LONG_DOUBLE, __NO_LONG_DOUBLE_MATH, and then
> __LONG_DOUBLE_MATH_OPTIONAL are to achieve, and which I have to care for;
> also whether I need to do anything with sysdeps/ieee754/ldbl-opt and
> sysdeps/ieee754/ldbl-64-128 (don't think so)?
I don't think an __issignalingl alias should be provided. If double and
long double have the same representation, the header macro should never
call __issignalingl. By not providing it, you avoid needing special
symbol versioning if any architectures move in future to having distinct
long double.
> On 32-bit x86, the __issignalingf and __issignaling functions already
> "fail" at the call site:
>
> 804a130: d9 05 18 e1 04 08 flds 0x804e118
> 804a136: d9 1c 24 fstps (%esp)
> 804a139: e8 d2 eb ff ff call 8048d10 <__issignalingf@plt>
Does this depend on compiler options (you don't say what specific code
shows this problem)? A test I did of passing a float variable to a
function used integer load/store to move it to the stack, not
floating-point.
> For float and double (but not long double), per the x86 ISA, this will
> load the sNaN variable (0x804e118), but then turn it into a qNaN and
> raise the INVALID exception. (Thus, the __issignalingf function will
> never be able to detect a sNaN.) I hope to get around this by adding
> always_inline definitions for the __issignaling functions to the
> respective mathinline.h files. (But what about someone using <math.h>
Or the macro could use a union to pass the value to a function defined to
take an integer value, if that helps.
--
Joseph S. Myers
joseph@codesourcery.com