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

Marco van de Voort marcov at stack.nl
Fri Feb 2 16:16:13 CET 2018


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".

> 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

uses unixtype;

begin
  writeln(sizeof(clongdouble));
end.

writes "10".

Afaik some work has gone in softfloat in the last years, and maybe there is
an emulated 128-bit type now, but that is news for me. (Florian,Jonas: ?)

>  So, as long as I use clongdouble for the external declarations, there
> should be no problem (I hope).

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.


More information about the fpc-pascal mailing list