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

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

Real Data Types

Real data types can be specified as follows:

REAL

REAL([KIND=]n)

REAL*n

DOUBLE PRECISION

n

Is a constant expression that evaluates to kind 4, 8, or 16.

The named constants for REAL kind values are defined in the intrinsic module ISO_FORTRAN_ENV: REAL32=4, REAL64=8, and REAL128=16.

If a kind parameter is specified, the real constant has the kind specified. If a kind parameter is not specified, the kind is default real.

Default real is affected by compiler options specifying real size and by the REAL directive.

The default KIND for DOUBLE PRECISION is affected by compiler option double-size. If this compiler option is not specified, default DOUBLE PRECISION is REAL(8).

No kind parameter is permitted for data declared with type DOUBLE PRECISION.

The intrinsic inquiry function KIND returns the kind type parameter. The intrinsic inquiry function RANGE returns the decimal exponent range, and the intrinsic function PRECISION returns the decimal precision. You can use the intrinsic function SELECTED_REAL_KIND to find the kind values that provide a given precision and exponent range.

Examples

The following examples show how real variables can be declared.

An entity-oriented example is:

 REAL (KIND = high), OPTIONAL :: testval
 REAL, SAVE :: a(10), b(20,30)

An attribute-oriented example is:

 REAL (KIND = high) testval
 REAL a(10), b(20,30)
 OPTIONAL testval
 SAVE a, b