long double (was "strtold?")

Jeff Johnston jjohnstn@redhat.com
Mon Apr 20 21:15:00 GMT 2009


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.)
>  
>   
First of all, the prototype existence is separate from the LDBL eq DBL.  
We can expose the prototypes for all platforms that support long double, 
but there will be disappointment when they don't link because they are 
not implemented in general.

There may be platforms that wish to supply implementations of these 
functions for real long double.  So, I wanted a different flag name they 
could use.  The LDBL eq DBL scenario implies that the current 
implementations are supplied and that the prototypes can/should be 
exposed.  I made two flags so one could expose either of the two sets of 
prototypes in the corresponding header files as desired.

I could make these _WANT_LDBL_MATH_PROTOTYPES, 
_WANT_LDBL_STDLIB_PROTOTYPES, to clarify, ..whatever...
> 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.
>  
>   
That may likely be a while.
> 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.
>  
>   
Putting Ken's only-with-gcc check in libc/sys/config.h accomplishes this 
as it will turn both flags on but it still allows a platform to expose 
the prototypes and implement the function specifically for the platform 
(e.g. done via special hardware insns).
> 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 think an executable test is required to accomplish this which can't be 
done in newlib due to the
missing library at time of configure.

-- Jeff J.
>  
> Craig
>
> -----Original Message-----
> From: Jeff Johnston [mailto:jjohnstn@redhat.com] 
> Sent: Monday, April 20, 2009 2:13 PM
> To: Ken Werner
> Cc: newlib@sourceware.org; Howland Craig D (Craig)
> Subject: Re: long double (was "strtold?")
>
> Ken Werner wrote:
>   
>> On Saturday 18 April 2009 00:14:13 you wrote:
>>   
>> Hi,
>>
>> Sounds fine for the implementation of the wrapper frunctions but what
>>     
> about 
>   
>> their prototypes? Are you going to include "local.h" from the  math.h
>>     
> and 
>   
>> stdlib.h?
>>
>> Ken
>>   
>>     
> My bad...I should have renamed the flag in the headers.  It will now be 
> _HAVE_LDBL_MATH for math.h and _HAVE_LDBL_STDLIB  for stdlib.h which for
>
> now have to be manually set per platform (typically via 
> libc/include/sys/config.h).  I am open to putting your gcc-specific 
> check into libc/include/sys/config.h which would then set the two flags 
> automatically, if not already set.
>
> -- Jeff J.
>
>
>   



More information about the Newlib mailing list