This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: sizeof(long double) vs. std::numeric_limits and x86-64 vs x86
- From: Ian Lance Taylor <iant at google dot com>
- To: Michael Veksler <mveksler at techunix dot technion dot ac dot il>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 26 Sep 2011 15:46:49 -0700
- Subject: Re: sizeof(long double) vs. std::numeric_limits and x86-64 vs x86
- References: <4E80F88F.2050608@tx.technion.ac.il>
Michael Veksler <mveksler@tx.technion.ac.il> writes:
> I wanted to check how many bits long double takes. So I checked
> sizeof(long double) which, naturally, may account for padding. On
> x86-64 it takes 16 bytes and only 12 on x86, a difference of 4
> bytes. This supported my hope that on x86-64 we would have "long
> double"= |__float128|.
Alas, no. On x86_64 long double is an 80-bit floating point number,
just as on 32-bit x86. The size is 16 bytes because the x86_64 prefers
to align large values to 8-byte boundaries.
gcc works this way because the 80-bit floating point format is supported
directly in hardware, unlike the 128-bit format.
Ian