The long double type

The greatest distinction between systems adhering to the IEEE floating-point standards, including CommonPoint platforms, lies in the implementation details of the long double format. The standards set only minimum requirements for the precision and exponent range of long double, leading to a variety of implementations (some of which don't even conform to the IEEE requirements). "Numerical specifications of the floating-point types" on page 208 discussed the three flavors of long double that encompass virtually all implementations of long double on IEEE standard platforms, CommonPoint or not:


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.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker