This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: long double (was "strtold?")


Ken Werner wrote Thursday, April 02, 2009 8:59 AM:
>
>Why would anyone with a platform where there's no difference between
> double and long double prefer the long double routine?

The short, perhaps cryptic answer, is, when the size of double does
not match the double functions but does match the long double functions.

To elaborate, using some slightly different diction to hopefully make it
clear, the Newlib math library currently has two set of math routines.
The first works on IEEE binary64, and is normally named for the double
functions.  The second set works on IEEE binary32 and is named for the
float functions.  On platforms where double is binary32, the double
functions are defined to be wrappers calling the hard-coded binary32
("float") routines, instead of calling the binary64 routines.
 
If there ever were a platform on which double were neither binary64 nor
binary32, Newlib would presently be out of business.  But, if at that
time we had dual-use binary80/128 routines that were normally named for
the long double functions and double were 80 or 128, then the double
functions could be wrappers to the binary80/128 ("long double")
routines.
 
Craig


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]