Real Data Types

Real data types can be specified as follows:

REAL
REAL([KIND=]n)
REAL*n
DOUBLE PRECISION

n
Is kind 4, 8, or 16. Kind 16 is only available on OpenVMS, Tru64 UNIX, and Linux systems.

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.

DOUBLE PRECISION is REAL(8). No kind parameter is permitted for data declared with type DOUBLE PRECISION.

You can change the result of a default specification by using the /real_size:size compiler option or the REAL compiler directive.

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.

For more information on real data types, see General Rules for Real Constants, REAL(4) Constants, REAL(8) or DOUBLE PRECISION Constants, and REAL(16) Constants (VMS, U*X).

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