Description of Problem: According to the IEEE standard: sizeof(float) = 4 bytes; sizeof(double) = 8 bytes; sizeof(long double) = 16 bytes; The size of a long double is 8 bytes. Version-Release number of selected component (if applicable): gcc 2.96 How Reproducible: always Steps to Reproduce: 1. Compile the program a.C below: g++ -g -mieee a.C 2. ./a.out Actual Results: sizeof(long double) = 8 Expected Results: sizeof(long double) = 16 Additional Information: Expected results achieved on ia64-Linux platform. Begin Program a.C: #include <stdio.h> int main(int argc, char *argv[]) { printf("sizeof(long double) = %d bytes\n",sizeof(long double)); return 0; } End Program a.C
IEEE 754 doesn't speak about C floating types, it just defines a single precision, double precision and quad precision data format (and IEEE 854 adds double extended precision). How this maps onto C types is the matter of the various architecture ABIs. You cite above IA-64, but although sizeof (long double) is 16 on IA-64, it is actually not the quad precision IEEE 754 data format, but IEEE 854 double extended. IA-32 uses double extended precision long double too, though sizeof (long double) is there 12. Most architectures use double precision for double and long double, some (like 64-bit SPARC and in the not too distant future 32-bit SPARC and PPC too) use quad precision for long double.