Size of float_t

Mike Wey mike-wey at example.com
Sat Oct 26 05:25:24 PDT 2013


I need to interface with an C lib that uses float_t and double_t.
Druntime provides aliases for these in core.stdc.math but it aliases 
then to float and double respectively.

Now on 64-bits Linux (Arch) this work without any problems, but on a 
32-bits copy of ArchLinux both float_t and double_t are defined as long 
double.

This can be observed by running the following C code on both systems:

```
#include <stdio.h>
#include <math.h>

int main(int argc,char **argv)
{
     printf("%i ", sizeof(float_t));
     printf("%i ", sizeof(float));
     printf("%i ", sizeof(double_t));
     printf("%i \n", sizeof(double));
}
```
Prints 4 4 8 8 on 64-bits ArchLinux.
And 12 4 12 8 on 32-bits ArchLinux.


Does anybody know if float_t and double_t being long doubles is common 
among 32-bits Linux distros, or if it may depend on the compiler 
version, processor type or something else?

-- 
Mike Wey


More information about the Digitalmars-d mailing list