Next: , Previous: RAN, Up: Intrinsic Procedures


6.175 REAL — Convert to real type

Description:
REAL(X [, KIND]) converts its argument X to a real type. The REALPART(X) function is provided for compatibility with g77, and its use is strongly discouraged.
Standard:
F77 and later
Class:
Elemental function
Syntax:

RESULT = REAL(X [, KIND])
RESULT = REALPART(Z)

Arguments:

X Shall be INTEGER(*), REAL(*), or COMPLEX(*).
KIND (Optional) An INTEGER(*) initialization expression indicating the kind parameter of the result.

Return value:
These functions return a REAL(*) variable or array under the following rules:
(A)
REAL(X) is converted to a default real type if X is an integer or real variable.
(B)
REAL(X) is converted to a real type with the kind type parameter of X if X is a complex variable.
(C)
REAL(X, KIND) is converted to a real type with kind type parameter KIND if X is a complex, integer, or real variable.

Example:
          program test_real
            complex :: x = (1.0, 2.0)
            print *, real(x), real(x,8), realpart(x)
          end program test_real
     

See also:
DBLE, DFLOAT, FLOAT