REAL — Convert to real type ¶RESULT = REAL(A [, KIND]) |
RESULT = REALPART(Z) |
REAL(A [, KIND]) converts its argument A to a real type. The
REALPART function is provided for compatibility with g77,
and its use is strongly discouraged.
Elemental function
| A | Shall be INTEGER, REAL,
COMPLEX or UNSIGNED. |
| KIND | (Optional) A scalar INTEGER constant
expression indicating the kind parameter of the result. |
These functions return a REAL variable or array under
the following rules:
REAL(A) is converted to a default real type if A is an
integer, real or unsigned variable.
REAL(A) is converted to a real type with the kind type parameter
of A if A is a complex variable.
REAL(A, KIND) is converted to a real type with kind type
parameter KIND if A is a complex, integer, real
or unsigned variable.
program test_real complex :: x = (1.0, 2.0) print *, real(x), real(x,8), realpart(x) end program test_real
| Name | Argument | Return type | Standard |
|---|---|---|---|
FLOAT(A) | INTEGER(4) | REAL(4) | Fortran 77 and later |
DFLOAT(A) | INTEGER(4) | REAL(8) | GNU extension |
FLOATI(A) | INTEGER(2) | REAL(4) | GNU extension (-fdec) |
FLOATJ(A) | INTEGER(4) | REAL(4) | GNU extension (-fdec) |
FLOATK(A) | INTEGER(8) | REAL(4) | GNU extension (-fdec) |
SNGL(A) | REAL(8) | REAL(4) | Fortran 77 and later |
Fortran 77 and later, with KIND argument Fortran 90 and later,
has GNU extensions. Extension for UNSIGNED (see Unsigned integers).