15.1.17 REAL Directive

The REAL directive specifies the default real kind. This directive takes the following form: [See Note]

cDEC$ REAL:{4|8|16}

c
Is one of the following: C (or c), !, or * (see Section 15.1.1).

Rules and Behavior

The REAL directive specifies a size of 4 (KIND=4), 8 (KIND=8), or 16 (KIND=16) bytes for default real numbers. REAL(KIND=16) is only available on OpenVMS and Tru64 UNIX systems.

When the REAL directive is effect, all default real variables are of the kind specified in the directive. Only numbers specified or implied as REAL without KIND are affected.

The REAL directive can only appear at the top of a program unit. A program unit is a main program, an external subroutine or function, a module or a block data program unit. The directive cannot appear between program units, or at the beginning of internal subprograms. It does not affect modules invoked with the USE statement in the program unit that contains it.

Examples

Consider the following:

 REAL r                  ! a 4-byte REAL
 WRITE(*,*) KIND(r)
 CALL REAL8( )
 WRITE(*,*) KIND(r)      ! still a 4-byte REAL
                         !   not affected by setting in subroutine
 END
 SUBROUTINE REAL8( )
    !DEC$ REAL:8
    REAL s               ! an 8-byte REAL
    WRITE(*,*) KIND(s)
 END SUBROUTINE

Note: The following form is also allowed: !MS$REAL:{4|8}

For More Information:


Previous Page Next Page Table of Contents