From https://en.wikipedia.org/wiki/Long_double:
In C++,
long double
refers to a floating-point data type that is often more precise than double-precision. However, as with C++'s other floating-point types, it may not necessarily map to an IEEE format....
With the GNU C Compiler,
long double
is 80-bit extended precision on x86 processors regardless of the physical storage used for the type (which can be either 96 or 128 bits). On some other architectures,long double
can bedouble-double
(e.g. on PowerPC) or 128-bit quadruple precision (e.g. on SPARC). As of gcc 4.3, a quadruple precision is also supported on x86, but as the nonstandard type__float128
rather thanlong double
.With gcc on Linux, 80-bit extended precision is the default; on several BSD operating systems (FreeBSD and OpenBSD), double-precision mode is the default, and long double operations are effectively reduced to double precision.
The Intel C++ Compiler for x86, on the other hand, enables extended-precision mode by default. On OS X, long double is 80-bit extended precision.
It seems like indeed long double
may not be an implementation of IEEE's binary128, but why not make this the case? Why defaulting to an 80-bit representation on some cases?