An integer constant is a whole number with no decimal point. It
can have a leading sign and is interpreted as a decimal number.
VSI Fortran provides four kind type parameters for data of type
integer: INTEGER(KIND=1) (or INTEGER*1), INTEGER(KIND=2) (or
INTEGER*2), INTEGER(KIND=4) (or INTEGER*4), and INTEGER(KIND=8) (or
INTEGER*8).
The type specifier for the integer type is INTEGER.
If a kind type parameter is specified, the integer has the kind
specified. If a kind type parameter is not specified, integer
constants are interpreted as follows:
o If the integer constant is within the default integer kind, the
kind is default integer.
o If the integer constant is outside the default integer kind,
the kind type of the integer constant is the smallest integer
kind which holds the constant.
Integer constants take the following form:
[s]n[n...][_k]
s Is a sign; required if negative (-), optional if
positive (+).
n Is a decimal digit (0 through 9). Any leading
zeros are ignored.
k Is an optional kind type parameter (1 for
INTEGER(KIND=1), 2 for INTEGER(KIND=2), 4 for
INTEGER(KIND=4), and 8 for INTEGER(KIND=8)). It
must be preceded by an underscore (_).
An unsigned constant is assumed to be nonnegative.
Integers are expressed in decimal values (base 10) by default.
To specify a constant that is not in base 10, use the following
syntax:
[s][[base] #]nnn...
s Is a sign; required if negative (-), optional if
positive (+).
base Is any constant from 2 through 36.
If "base" is omitted but # is specified, the integer is interpreted
in base 16. If both "base" and # are omitted, the integer is
interpreted in base 10.
For bases 11 through 36, the letters A through Z represent numbers
greater than 9. For example, for base 36, A represents 10, B
represents 11, C represents 12, and so on, through Z, which
represents 35. The case of the letters is not significant.
For example, the following integers are all assigned a value equal
to 3994575 decimal:
I = 2#1111001111001111001111
K = #3CF3CF
n = +17#2DE110
index = 36#2DM8F
You can use integer constants to assign values to data. The
integer data types have the following ranges:
BYTE Same range as INTEGER*1
INTEGER*1 Signed integers: -128 to 127 (-2**7 to 2**7-1)
(1 byte) Unsigned integers: 0 to 255 (2**8-1)
INTEGER*2 Signed integers: -32768 to 32767
(2 bytes) (-2**15 to 2**15-1)
Unsigned integers: 0 to 65535 (2**16-1)
INTEGER*4 Signed integers: -2147483648 to 2147483647
(4 bytes) (-2**31 to 2**31-1)
Unsigned integers: 0 to 4294967295 (2**32-1)
INTEGER*8 Signed integers: -9223372036854775808 to
(8 bytes) 9223372036854775807 (-2**63 to 2**63-1)
NOTE1: The value of an integer constant must be within
INTEGER(KIND=8) range.
NOTE2: The "unsigned" ranges above are allowed for assignment
to variables of these types, but the data type is
treated as signed in arithmetic operations.