XL Fortran extended
precision is not in the format suggested by the IEEE standard, which
suggests extended formats using more bits in both the exponent (for
greater range) and the fraction (for greater precision).
XL Fortran extended
precision, equivalent to REAL(16) in Fortran programs,
is implemented in software. Extended precision provides the same range
as double precision (about 10**(-308) to 10**308) but more precision
(a variable amount, about 31 decimal digits or more). The software
support is restricted to round-to-nearest mode. Programs that use
extended precision must ensure that this rounding mode is in effect
when extended-precision calculations are performed. See Selecting the rounding mode for the different ways you can control
the rounding mode.
Programs that specify extended-precision values as hexadecimal,
octal, binary, or Hollerith constants must follow these conventions:
- Extended-precision numbers are composed of two double-precision
numbers with different magnitudes that do not overlap (except when
the number is zero or close to zero). That is, the binary exponents
differ by at least the number of fraction bits in a REAL(8).
The high-order double-precision value (the one that comes first in
storage) must have the larger magnitude. The value of the extended-precision
number is the sum of the two double-precision values.
- For a value of NaN or infinity, you must encode one
of these values within the high-order double-precision value. The
low-order value is not significant except that it cannot be set to
NaN when the high-order value is infinity.
Because an
XL Fortran extended-precision
value can be the sum of two values with greatly different exponents,
leaving a number of assumed zeros in the fraction, the format actually
has a variable precision with a minimum of about 31 decimal digits.
You get more precision in cases where the exponents of the two double
values differ in magnitude by more than the number of digits in a
double-precision value. This encoding allows an efficient implementation
intended for applications requiring more precision but no more range
than double precision.
Note: - In the discussions of rounding errors because of compile-time
folding of expressions, keep in mind that this folding produces different
results for extended-precision values more often than for other precisions.
- Special numbers, such as NaN and infinity, are not fully supported
for extended-precision values. Arithmetic operations do not necessarily
propagate these numbers in extended precision.
- XL Fortran does not always detect floating-point exception conditions
(see Detecting and trapping floating-point exceptions) for extended-precision
values. If you turn on floating-point exception trapping in programs
that use extended precision, XL Fortran may also generate signals
in cases where an exception condition does not really occur.