[fpc-pascal] libc and math.h on Linux

Adriaan van Os fpc at microbizz.nl
Fri Feb 2 16:55:18 CET 2018


Marco van de Voort wrote:
> In our previous episode, Adriaan van Os said:
>>> Long double is probably 10-byte extended, but verify that by compiling and
>>> running a small C program for your distro.
>> I assume that the FPC clongdouble type has the right size ?
> 
> Define "right".

Well, a cxxx type is "right" if FPC cxxx and GCC xxx have the same size, which after all is the 
purpose of having these types in FPC.

> 
>> I checked on OS X (x86) where FPC longdouble is 10-byte, FPC clongdouble
>> is 16-byte and GCC long double is 16 byte too.
> 
> Maybe a heritage of PPC that did have a 128-bit fp type. But x86/x86_64 to my
> knowledge doesn't have such type, and I just tested and Linux

When I look at the source of GCC and GPC for OS X, I believe it is a 10-byte extended stuffed into 
a 16-byte type. Calling e.g. sinl works fine on OS X when declared either "wrong" with 10-byte or 
"right" with 16-byte parameters.

> glibc might have changed from ye old days when it was 80-bit. Which is why I recommended to double check in the first place.

Will do so.

Regards,

Adriaan van Os




More information about the fpc-pascal mailing list