long double (was "strtold?")

Schwarz, Konrad konrad.schwarz@siemens.com
Thu Mar 12 09:14:00 GMT 2009


> -----Original Message-----
> From: newlib-owner@sourceware.org 
> [mailto:newlib-owner@sourceware.org] On Behalf Of Ken Werner
> Sent: Wednesday, March 11, 2009 7:05 PM
> To: newlib@sourceware.org; Howland Craig D (Craig)
> Subject: Re: long double (was "strtold?")
> 
> Hi,
> What about mapping the long double functions to their 
> counterparts on platforms where a double is as wide as a long 
> double? The attached patch introduces a flag defined in 
> sys/features.h. You mentioned HAVE_LONG_DOUBLE_WIDER but the 
> user may not define this flag. Do you want to generate a 
> header file that exposes this flag? Wouldn't that result in 
> something like config.h to be shipped with newlib or am I 
> missing something?

Hi,

may I suggest deriving the flag (_DOUBLE_EQUALS_LONG_DOUBLE) from macros
defined by <float.h>?  E.g., replace

# ifdef _DOUBLE_EQUALS_LONG_DOUBLE

with

# if _DOUBLE_EQUALS_LONG_DOUBLE

Define _DOUBLE_EQUALS_LONG_DOUBLE as 

# define _DOUBLE_EQUALS_LONG_DOUBLE (DBL_MANT_DIG == LDBL_MANT_DIG\
		&& LDBL_MIN_EXP == DBL_MIN_EXP\
		&& LDBL_MAX_EXP == DBL_MAX_EXP)

This would simplify porting to new targets.

Konrad Schwarz



More information about the Newlib mailing list