Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

Binary, Octal, Hexadecimal, and Hollerith Constants

Binary, octal, hexadecimal, and Hollerith constants are nondecimal constants. They have no intrinsic data type, but assume a numeric data type depending on their use.

Standard Fortran allows unsigned binary, octal, and hexadecimal constants to be used in DATA statements; the constant must correspond to an integer scalar variable. These constants can also appear as arguments to certain standard intrinsic functions as indicated in their individual descriptions.

Binary, octal, and decimal constants are also permitted as real or integer ac-values in array constructors, as real or integer values in PARAMETER statements, as real or integer values on the right-hand side (RHS) of assignment statements, and as integer values in ENUMERATION statements.

Each digit of a binary, octal, or hexadecimal literal constant represents a sequence of bits, according to its numerical interpretation (see Model for Bit Data) with s in the model equal to the following:

  • one for binary constants

  • three for octal constants

  • four for hexadecimal constants

A binary, octal, or hexadecimal literal constant represents a sequence of bits that consists of the concatenation of the sequences of bits represented by its digits, in the order that the digits are specified. The positions of bits in the sequence are numbered from right to left, with the position of the rightmost bit being zero.

The length of a sequence of bits is the number of bits in the sequence. The position of the leftmost nonzero bit is interpreted to be at least m - 1, where m is the maximum value that could result from invoking the intrinsic function STORAGE SIZE with an argument that is a real or an integer scalar of any kind supported by the processor.

In Intel® Fortran, binary, octal, hexadecimal, and Hollerith constants can appear wherever numeric constants are allowed.