Platform |
Representation |
Significant bits | Decimal digits | Max normal number | Min normal number |
Implementation |
|
Details of long double types |
X86 | 80-bit IEEE | hardware | ||||
PA-RISC | 128-bit IEEE | software | |||||
PowerPC |
128-bit non-IEEE |
fast software |
The long double types as supported on X86 and PA-RISC systems provide the exponent range required by the IEEE standards of a double-extended format. On the PowerPC, long double is implemented as the mathematical sum of a pair of double values, so it has just the exponent range of double and doesn't meet the IEEE requirements for double-extended.
The precision of long double on X86, 64 bits, is the minimum required by the standards. PA-RISC offers almost twice the precision, using a 16-byte field for its long double. PowerPC offers at least twice the precision of double, but because its precision varies with the value represented its precision is hard to quantify.
The implementations of long double also differ in speed. The narrowest of them, on X86, is supported directly in hardware (that internally computes all intermediate results to long double). The widest of them, on PA-RISC, is supported in software significantly slower than corresponding double operations. PowerPC supports long double using its fused multiply-add instruction, so its operations are relatively fast, though not fully IEEE-compliant.
The IEEE standards intend that the long double type be used for intermediate calculations, rather than the storage and transmittal of data sets.
NOTE The long double type is a powerful tool for many calculations. How widely you should use it depends on a balance of speed, capability, and portability. Consider using the type double_t for best performance with at least the exponent range and precision of double.