REAL Statement

Statement: Specifies the REAL data type.

Syntax

REAL

REAL([KIND=] n)

REAL* n

DOUBLE PRECISION

n

Is an initialization expression that evaluates to kind 4, 8 or 16.

Description

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.

REAL(4) and REAL*4 (single precision) are the same data type. REAL(8), REAL*8, and DOUBLE PRECISION are the same data type.

Example

Entity-oriented examples are:

MODULE DATDECLARE

REAL (8), OPTIONAL :: testval=50.d0

REAL, SAVE :: a(10), b(20,30)

REAL, PARAMETER :: x = 100.

Attribute-oriented examples are:

MODULE DATDECLARE

REAL (8) testval=50.d0

REAL x, a(10), b(20,30)

OPTIONAL testval

SAVE a, b

PARAMETER (x = 100.)

See Also