This paves the way for discussion of that numerically useful feature of Fortran 90, the SELECTED_REAL_KIND intrinsic function, which allows the programmer to specify minimum decimal precision and/or exponent range properties. The SELECTED_REAL_KIND function has two optional integer arguments, at least one of which must be supplied, one for the desired decimal precision and the other for the desired (decimal) exponent range; SELECTED_REAL_KIND then returns the kind value for the ``smallest" kind of real data type the implementation supports that meets or exceeds these specified conditions. An error condition exists if there is no such data type. Thus, for example,

INTEGER, PARAMETER :: P9 = SELECTED_REAL_KIND(9)declares the integer constant P9 to have the real kind value appropriate to real objects with at least 9 decimal digits of precision. Variables meeting this requirement may be declared with the statement

REAL(P9) ...9 digit (at least) precision real variable...

On a Sun workstation the value of P9 would be the same as DOUBLE (as defined above); on a Cray supercomputer the value of P9 would be the same as SINGLE. That is, REAL(P9) declares double precision variables on the Sun and single precision variables on the Cray. With this technique entire programs may be portably written based upon desired precision/range properties of the variables rather than upon implementation defaults for single and double real precision. This in itself is a powerful tool for numerical robustness.

Real constants of any kind can be formed by appending the kind value with an underscore to the default single precision real constants provided by the language. Thus, using the kind values defined above:

1.41_SINGLE and 1.41 are the same, 1.41_DOUBLE and 1.41D0 are the same, 1.41_IEEE is the IEEE version of 1.41, 1.41_P9 is the appropriate 9+ digit representation of 1.41, and typically will be equivalent to 1.41_SINGLE or 1.41_DOUBLE