long double (was "strtold?")

Ken Werner ken@linux.vnet.ibm.com
Mon Apr 20 21:08:00 GMT 2009

On Monday 20 April 2009 20:39:07 Howland Craig D (Craig) wrote:
> The _LDBL_EQ_DBL flag is not for having long double, but that long
> double
> is the same size as float; those new names do not sound good for that.
> (The names sound more like long double is present or not.)

Currently the configure.in of libm and libc are checking for long double 
support and define HAVE_LONG_DOUBLE if available. This enables the Makefile.am 
to skip the long double sources. The implementation is guarded by _LDBL_EQ_DBL 
to allow switching between real code (if it gets implemented) and the wrapper.

> The need for stdlib.h and math.h to gate the prototypes should only be
> temporary, as when the "real" LDBL routines get added they come out of
> the gate--which eventually disappears.
> One thought is that perhaps to avoid a lot of angst over something that
> is only temporary, put the works-only-with-GCC check into config.h.  If
> someone wants the benefit with other than GCC, they can manually
> define _LDBL_EQ_DBL flag in config.h.

That would be fine for the SPU since the XLC defines __LDBL_MANT_DIG__ and 
friends too. I can't speak for other compilers out there.

> Another thought is that the check should really just be run by
> configure,
> and _LDBL_EQ_DBL gets put into something that configure generates,
> as in newlib.h.  (In certain respects this is perhaps best, as it
> records
> what the library was built with in case the user has a compiler option
> that changes long double size.  I did see that in the forthcoming GCC
> 4.4 that there seems to be an option for SW FP to use 128 bits vs. a
> default smaller size.)

I played with the AC_TYPE_LONG_DOUBLE_WIDER macro but there are two things to 
consider. We would need to upgrade the autoconf version required by newlib and 
introduce something like config.h (through AC_CONFIG_HEADERS). which might 
pollute the name space if it get's pulled by a standard header.

> Craig


More information about the Newlib mailing list