Suppose a processor supports three different range values for integers, -128--127, -65536--65535 and a 32-bit representation (-4.29*10^9--4.29*10^9):
INTEGER(KIND=1) :: a, b INTEGER(2) :: c, d INTEGER(4) :: e |
INTEGER, PARAMETER :: short = 1, medium = 2, long = 4 INTEGER(short) :: a, b INTEGER(medium) :: c, d INTEGER(long) :: e |
SELECTED_INT_KIND(r) |
-10^r < n < 10^r |
INTEGER, PARAMETER :: short = SELECTED_INT_KIND(2), & medium = SELECTED_INT_KIND(4), & long = SELECTED_INT_KIND(10) INTEGER(short) :: a, b INTEGER(medium) :: c, d INTEGER(long) :: e |
REAL, PARAMETER :: single = 4, double = 8, extended = 16; REAL(single) :: x, y REAL(double) :: xx, yy REAL(extended) :: eee |
SELECTED_REAL_KIND(p,r) |
REAL, PARAMETER :: single = SELECTED_REAL_KIND(5,20), & double = SELECTED_REAL_KIND(10,40), & extended = SELECTED_REAL_KIND(20,100) REAL(single) :: a, b REAL(double) :: c, d REAL(extended) :: e |
Is analogous to that for REAL --- same KIND values.
Skipped!
Skipped!
...previous | up (conts) | next... |