Lahey/Fujitsu Fortran

Data Types

Intrinsic Data Types

The five intrinsic data types are INTEGER, REAL, COMPLEX, LOGICAL, and CHARACTER. The DOUBLE PRECISION data type available in Fortran 77 is still supported, but is considered a subset, or kind, of the REAL data type.

Kind

In Fortran, an intrinsic data type has one or more kinds. In LF95 for the CHARACTER, INTEGER, REAL, and LOGICAL data types, the kind type parameter (a number used to refer to a kind) corresponds to the number of bytes used to represent each respective kind. For the COMPLEX data type, the kind type parameter is the number of bytes used to represent the real or the imaginary part. Two intrinsic inquiry functions, SELECTED_INT_KIND and SELECTED_REAL_KIND, are provided. Each returns a kind type parameter based on the required range and precision of a data object in a way that is portable to other Fortran 90 or 95 systems. The kinds available in LF95 are summarized in the following table:

Intrinsic Data Types

Type

Kind

Notes

INTEGER

1

Range: -128 to 127

INTEGER

2

Range: -32,768 to 32,767

INTEGER

4*

Range: -2,147,483,648 to 2,147,483,647

INTEGER

8

Range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

REAL

4*

Range: 1.18 * 10 -38 to 3.40 * 10 38

Precision: Approximately 7.2 decimal digits (Exactly 24 binary digits)

REAL

8

Range: 2.23 * 10 -308 to 1.79 * 10 308

Precision: Approximately 15.9 decimal digits (Exactly 53 binary digits)

REAL

16

Range: 10 -4931 to 10 4932

Precision: Approximately 34.0 decimal digits (Exactly 113 binary digits)

COMPLEX

4*

Range: 1.18 * 10 -38 to 3.40 * 10 38

Precision: Approximately 7.2 decimal digits (Exactly 24 binary digits)

COMPLEX

8

Range: 2.23 * 10 -308 to 1.79 * 10 308

Precision: Approximately 15.9 decimal digits (Exactly 53 binary digits)

COMPLEX

16

Range: 10 -4931 to 10 4932

Precision: Approximately 34.0 decimal digits (Exactly 113 binary digits)

LOGICAL

1

Values: .TRUE. and .FALSE.

LOGICAL

4*

Values: .TRUE. and .FALSE.

CHARACTER

1*

ASCII character set

* default kinds

Length

The number of characters in a CHARACTER data object is indicated by its length type parameter. For example, the CHARACTER literal "Half Marathon" has a length of thirteen.