next up previous contents
Next: Integer Data Type by Up: Fortran 90 Previous: Complex Data Type

 

Parameterised Intrinsic Types

 

FORTRAN 77 had a problem with numeric portability, the precision (and exponent range) of a data type on one processor would not necessarily be the same on another. For example, a default REAL may be able to support numbers up to (say) tex2html_wrap_inline28722 on one machine and up to tex2html_wrap_inline28724 on another. One of the goals of Fortran 90 was to overcome this portability problem. Fortran 90 implements a portable precision selecting mechanism, it supports types which can be parameterised by a kind value (an integer). The kind value is used to select a representation model for a type and, for numeric types, can be specified in terms of the required precision. A processor can support different precisions (or representations) of INTEGER, REAL and COMPLEX, different CHARACTER sets (for example, arabic, musical notation and cryllic script) and different ways of representing LOGICAL objects. DOUBLE PRECISION does not have different precisions and its use is not recommended -- use a parameterised REAL type instead.

An example of the parameterisation of an intrinsic type is,

    INTEGER(KIND=1) :: ik1
    REAL(4) :: rk4

The kind parameters correspond to differing precisions supported by the compiler (details in the compiler manual).

Objects of different kinds can be mixed in arithmetic expressions and rules exist for type coercion, procedure arguments, however, must match in type and kind. There is no type coercion across procedure boundaries.

Return to corresponding overview page gif




next up previous contents
Next: Integer Data Type by Up: Fortran 90 Previous: Complex Data Type

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.