FORTRAN Reference Manual

Language Elements
FORTRAN Reference Manual528615-001
2-11
Constants
Constants
A constant is an unvarying datum. A constant can be a number, a constant expression,
a complex value, a logical value, or a string of characters.
You can use a PARAMETER statement to create a symbolic name for a constant. See
the PARAMETER Statement on page 7-79.
Arithmetic Constants
Integer, real, double precision, and complex constants are called arithmetic constants.
Integer Constants
You must express an integer constant as a whole number. You can place a minus sign
in front of an integer to indicate a negative number. The following are examples of
integer constants:
123 <-- word integer
-52381 <-- doubleword integer
9814387278 <-- quadrupleword integer
An integer constant is considered to be of the smallest size (INTEGER*2, INTEGER*4,
INTEGER*8) that can contain it.
An integer constant cannot contain a decimal point or a comma. However, you can
make a constant more readable by grouping digits of the constant and separating the
groups with blanks. The compiler ignores the blanks. For example:
9 814 387 278
You can represent an integer constant in octal notation. An octal constant has the
range of a quadrupleword integer and is a string of from 1 to 22 digits—only the digits
0, 1, 2, 3, 4, 5, 6, and 7 are valid—prefixed with a percent sign (%). Precede the
percent sign with a minus sign if the number is negative. The following is an example
of a negative, octal integer.
-%1034621
Real Constants
A real constant is a string of decimal digits that must include a decimal point or an
exponent. It cannot include commas, but you can use embedded spaces for
readability. You can express a real constant as a decimal number. For example:
7.5
-.0001
24578.342