next up previous contents
Next: Kind Functions Up: Parameterised Intrinsic Types Previous: Constants of Selected Integer

 

Real KIND Selection

This works on a similar principle to integer kind selection, the intrinsic SELECTED_REAL_KIND can be parameterised with two values, the minimum precision and the minimum decimal exponent range, the corresponding kind value will be returned or, if the desired range cannot be supported, the result will be -1.

SELECTED_REAL_KIND(8,9) will return a kind value that supports numbers with a precision of 8 digits and decimal exponent range between -9 and +9.

Declarations are made in the same way as for INTEGER s, for example,

    INTEGER, PARAMETER :: r1 = SELECTED_REAL_KIND(5,20),  &
                          r2 = SELECTED_REAL_KIND(10,40)
    REAL(KIND=r1)       :: x, y, z
    REAL(r2), PARAMETER :: diff = 100.0_r2

COMPLEX variables are specified in the same way,

    COMPLEX(KIND=r1) :: cinema
    COMPLEX(r2) :: inferiority = (100.0_r2,99.0_r2)

Both parts of the complex number have the same numeric range.

It can also be seen how the literal kind specification is achieved by the use of the underscore.

Return to corresponding overview page gif


next up previous contents
Next: Kind Functions Up: Parameterised Intrinsic Types Previous: Constants of Selected Integer

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