3.4 The Numeric Approximation Model

Next: 3.5 Environmental Inquiry Up: 3 Numerical Robustness Previous: 3.3 Numeric Polymorphism

## 3.4 The Numeric Approximation Model

Dynamic access to the numerical properties of the implementation can enable the development of portable numerically robust software. Fortran 90 provides such access through a combination of a model of the methods for approximating real values and a set of corresponding intrinsic functions for extracting model values. These intrinsic functions, of which there are a total of 16, are called the environmental inquiry (nine) and numeric manipulation (seven) intrinsic functions.

Each kind of real number is modeled by

where

is the real value
is (the sign of the value)
is the radix (base) and is usually 2; is constant for a given real kind
is the base precision; is constant for a given real kind
is the base exponent of the value
is the i digit, base , of the value; ;
may be 0 only if all are

The principal characteristics of a given real kind are its values for and and its range for .

IEEE arithmetic is based upon a binary (=2) representation in which =24 (single precision), =56 (double precision), and ; IEEE uses what would be an exponent of to represent zero and NaNs (illegal or out-of-range values). A nonbinary example is that of IBM 370 real arithmetic, in which =16, =6 (single precision), =14 (double precision), and -127e127. In most implementations the main difference in the representation of different real kinds is the value of , though it is possible (and occasionally happens) for the value of or the range of to vary between kinds.

verena@csep1.phy.ornl.gov