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

 

Integer Data Type by Kind

Selecting kind parameters by an explicit integer is still not portable, the explicit integer will correspond to different precisions on different machines, a mechanism is needed to select a kind value on the basis of the desired precision. For integers this can only be achieved by using the SELECTED_INT_KIND intrinsic function. For example, SELECTED_INT_KIND(2) returns an integer which corresponds to the kind representation capable of expressing numbers in the range, tex2html_wrap_inline28730 . In the case of SELECTED_INT_KIND the argument specifies the minimum decimal exponent range for the desired model.

For example,

    INTEGER :: short, medium, long, vlong
    PARAMETER (short  = SELECTED_INT_KIND(2),  medium = SELECTED_INT_KIND(4),  &
               long   = SELECTED_INT_KIND(10), vlong  = SELECTED_INT_KIND(100))
    INTEGER(short)    :: a,b,c
    INTEGER(medium)   :: d,e,f
    INTEGER(long)     :: g,h,i

The above declarations specify that precision should be at least:

If a model with at least the stated precision is not available then the function will return -1 and any declaration using this kind value will give an error (at compile time).

Return to corresponding overview page gif


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

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