Converted from .HLP to .HTML by HLPTOHTML.

fortran .HLP

Bit

A bit constant is a binary, octal, or hexadecimal constant. You can use this type of constant wherever numeric constants are allowed and it assumes a numeric data type according to its context.

A binary constant has the form:

'c1c2c3...cn'B c is a 0 or 1

An octal constant has the form:

'c1c2c3...cn'O c is a digit in the range 0 - 7

A hexadecimal constant has the form:

'c1c2c3...cn'X c is a digit in the range 0 - 9, or a letter or in the range A - F, or a - f 'c1c2c3...cn'Z

Bit constants are "typeless" numeric constants. They assume data types based on their usage, according to the following rules:

o When the constant is used with a binary operator, including the assignment operator, the data type of the constant is the data type of the other operand.

o When a specific data type is required, that type is assumed for the constant.

o When the constant is used as an actual argument, no data type is assumed; however, a length of 4 bytes is always used.

o When the constant is used in any other context, an INTEGER*4 data type is assumed.

Note that on VAX systems, the following example causes a data-typing problem:

I = 80 * '01000000'X

The quantity '01000000'X is typeless and assumes the data type of operand 80. The compiler treats 80 as an INTEGER*2 quantity (since its value is within the range -32768 to 32767), and tries to convert '01000000'X to INTEGER*2. Since '01000000'X is too large for the INTEGER*2 type, you get an error message.

You can avoid this problem by giving the constant an INTEGER*4 type in a PARAMETER statement, as follows:

INTEGER*4 K PARAMETER (K = '01000000'X)

Character

A character constant is a string of printable ASCII characters enclosed by apostrophes. A character constant has the form:

'c1,c2,c3...cn' c is a printable character.

The length of the character constant is the number of characters between the apostrophes, except that two consecutive apostrophes represent a single apostrophe. The length of a character constant must be in the range 1 to 2000.

Complex

A complex constant consists of a pair of real or integer constants. The two constants are separated by a comma and enclosed in parentheses. The first constant represents the real part of the number and the second constant represents the imaginary part.

DEC Fortran supports COMPLEX*8 and COMPLEX*16 complex constants.

A COMPLEX*8 has the form:

(c,c) c is an integer or REAL*4 constant

A COMPLEX*16 has the form:

(c,c) c is an integer, REAL*4, or REAL*8 constant (at least one of the pair must be a REAL*8 constant)

Hollerith

A Hollerith constant is a string of printable characters preceded by a character count and the letter H. It is used only in numeric expressions and has the form:

nHc1c2c3...cn

n Is an unsigned, nonzero integer constant stating the number of characters in the string (including tabs and spaces).

c Is a printable character.

A Hollerith constant can be a string of 1 to 2000 characters and is stored as a byte string, one character per byte.

Hollerith constants have no data type, but assume a numeric data type according to the context in which they are used.

Integer

An integer constant is a whole number with no decimal point. It can have a leading sign and is interpreted as a decimal number. It has the form:

snn s is an optional sign nn is a string of decimal digits

The value of the integer constant must be in the range -2147483648 to 2147483647.

You can use integer constants to assign values to data. The integer data types have the following ranges:

BYTE Same range as LOGICAL*1 and 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)

Integer constants in an octal form are preceded by a quotation mark and must use only the digits 0-7.

Logical

The logical constants are .TRUE. and .FALSE.

REAL_4

A REAL*4 constant can be a basic real constant (with or without a decimal exponent) or an integer constant followed by a decimal exponent. A basic real constant has one of these forms:

s.nn s is an optional sign snn.nn nn is a string of decimal digits snn.

A decimal exponent has the form:

Esnn s is an optional sign nn is an integer constant

REAL_8

A REAL*8 constant can be a basic real constant or an integer constant followed by a decimal exponent. A decimal exponent has the form:

Dsnn s is an optional sign nn is a string of decimal digits

There are two implementations of the REAL*8 constant: D_floating and G_floating. G_floating requires the /G_FLOATING command qualifier.

REAL_16

A REAL*16 constant can be a basic real constant or an integer constant followed by a decimal exponent. A decimal exponent has the form:

Qsnn s is an optional sign nn is a string of decimal digits