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, if the bit constant is greater than 4 bytes, INTEGER*8 is assumed; otherwise, INTEGER*4 is assumed.
o When the constant is used in any other context, an INTEGER*4 data type is assumed (unless the -noi4 or -i8 (AXP only) compiler option specifies otherwise).
A character constant is a string of printable ASCII characters enclosed by delimiters. It takes one of the following forms:'c1,c2,c3...cn' "c1,c2,c3...cn"
where c is a printable character
The length of the character constant is the number of characters between the delimiters. In the apostrophe format, two consecutive apostrophes represent a single apostrophe. In the quotation mark format, two consecutive quotation marks represent a single quotation mark.
The length of a character constant must be in the range 1 to 2000.
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 (COMPLEX*8) constant has the form:
(c,c) c is an integer or REAL (REAL*4) constant
A DOUBLE COMPLEX (COMPLEX*16) constant has the form:
(c,c) c is an integer, REAL (REAL*4), or DOUBLE PRECISION (REAL*8) constant (at least one of the pair must be a DOUBLE PRECISION constant)
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.
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 (leading zeros are ignored)
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) NOTE: On RISC processors, the value of an integer constant must be within this range.
INTEGER*8 Signed integers: -9223372036854775808 to (AXP only) 9223372036854775807 (-2**63 to 2**63-1) (8 bytes) NOTE: On Alpha AXP processors, the value of an integer constant must be within this range.
Note that logical data type ranges correspond to their comparable integer data type ranges. For example, the LOGICAL*2 range is the same as the INTEGER*2 range.
The value of an integer constant is normally INTEGER*2, INTEGER*4, or INTEGER*8 (AXP only). If a value is within INTEGER*2 range, it is treated as an INTEGER*2 value; if a value is outside INTEGER*2 range, but within INTEGER*4 range, it is treated as an INTEGER*4 value, and so forth.
The logical constants are .TRUE. and .FALSE.Note that logical data type ranges correspond to their comparable integer data type ranges. For example, the LOGICAL*2 range is the same as the INTEGER*2 range. For more information on integer data type ranges, see DATA CONSTANTS INTEGER in this online Help file.
A REAL (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
The approximate range of a nonzero REAL constant is 1.175E-38 to 3.403E38 (S_floating).
S_floating computational results smaller than 1.17549429E-38 are denormalized numbers that gradually underflow and lose precision, until they reach approximately 1.40129846E-46. You cannot write a constant for a denormalized number.
A DOUBLE PRECISION (REAL*8) constant can be a basic real constant or an integer constant followed by a decimal exponent. A decimal exponent has the form:Dsnnn s is an optional sign nnn is a string of decimal digits
NOTE: DEC Fortran also allows the syntax Qsnnn, if the exponent field is within the T_floating double precision range.
On RISC processors, the DOUBLE PRECISION data type implements the IEEE T_floating format. The approximate ranges of a nonzero DOUBLE PRECISION constant are 2.225D-308 to 1.798D308 (T_floating).
T_floating computational results smaller than 2.2250738585072012D-308 are denormalized numbers that gradually underflow and lose precision, until they reach approximately 4.9406564584124654D-324. You cannot write a constant for a denormalized number.
This type of constant is not available in DEC Fortran.