Bug 64938 - sizeof(long double) should be 16 bytes, not 8
sizeof(long double) should be 16 bytes, not 8
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
alpha Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2002-05-14 18:00 EDT by Christopher Holmes
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-12-15 15:20:15 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Christopher Holmes 2002-05-14 18:00:10 EDT
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:

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
Comment 1 Jakub Jelinek 2002-05-17 05:43:34 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.