Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public
Document Table of Contents

Integer Data Representations

The Fortran numeric environment is flexible, which helps make Fortran a strong language for intensive numerical calculations. The Fortran standard purposely leaves the precision of numeric quantities and the method of rounding numeric results unspecified. This allows Fortran to operate efficiently for diverse applications on diverse systems.

The effect of math computations on integers is straightforward:

  • INTEGER(KIND=1) Representation consists of a maximum positive integer (127), a minimum negative integer (-128), and all integers between them including zero.

  • INTEGER(KIND=2) Representation consists of a maximum positive integer (32,767), a minimum negative integer (-32,768) , and all integers between them including zero.

  • INTEGER(KIND=4) Representation consists of a maximum positive integer (2,147,483,647), a minimum negative integer (-2,147,483,648), and all integers between them including zero.

  • INTEGER(KIND=8) Representation consists of a maximum positive integer (9,223,372,036,854,775,807), a minimum negative integer (-9,223,372,036,854,775,808), and all integers between them including zero.

NOTE:

In the figures of the INTEGER representations, the symbol :A specifies the address of the byte containing bit 0, which is the starting address of the represented data element.

Operations on integers usually result in other integers within this range. Integer computations that produce values too large or too small to be represented in the desired KIND result in the loss of precision. One arithmetic rule to remember is that integer division results in truncation (for example, 8/3 evaluates to 2).

Integer data lengths can be 1, 2, 4, or 8 bytes in length.

The default data size used for an INTEGER data declaration is INTEGER(4) (same as INTEGER(KIND=4)). However, you can specify a compiler option to override the default. Option integer-size 16 can be used to specify INTEGER(2) and option integer-size 64 can be used to specify INTEGER(8).

Integer data is signed with the sign bit being 0 (zero) for positive numbers and 1 for negative numbers.