Purpose
Convert to real type.
Argument type and attributes
- A
- An INTENT(IN) INTEGER, REAL, COMPLEX or
boz-literal CONSTANT
- KIND (optional)
- An INTENT(IN) INTEGER scalar.
The actual argument corresponding to KIND must
be a constant expression.
Result type and attributes
- Real.
- Case (i): If A is of type integer or real and KIND is
present, the kind type parameter is that specified by KIND.
If A is of type integer or real and KIND is
not present, the kind type parameter is the kind type parameter of
the default real type.
- Case (ii): If A is of type complex and KIND is
present, the kind type parameter is that specified by KIND.
If A is of type complex and KIND is not
present, the kind type parameter is the kind type parameter of A.
- Case (iii): If A is a boz-literal constant and KIND is
present, the kind type parameter is that specified by KIND.
If A is a boz-literal constant and KIND is
not present, the kind type parameter is that of default real type.
If -qxlf2003=nobozlitargs is specified the
boz-literal constant is treated as an integer.
Result value
- Case (i): If A is of type integer or real, the result
is equal to a kind-dependent approximation to A.
- Case (ii): If A is of type complex, the result is equal to a kind-dependent
approximation to the real part of A.
- Case (iii): If A is a boz-literal constant, the value of
the result is equal to the value that a variable of the same type
and kind type parameters as the result would have if its value were
the bit pattern specified by the boz-literal constant.
Examples
REAL (-3)
has the value -3.0. REAL ((3.2, 2.1)) has
the value 3.2.
Specific Name |
Argument Type |
Result Type |
Pass As Arg? |
REAL |
default integer |
default real |
no |
FLOAT |
any integer 1 |
default real |
no |
SNGL |
double precision real |
default real |
no |
SNGLQ |
REAL(16) |
default real |
no 2 |
DREAL |
double complex |
double precision real |
no 2 |
QREAL |
COMPLEX(16) |
REAL(16) |
no 2 |
Note: - 1 IBM extension: the
ability to specify a nondefault integer argument.
- 2 IBM extension: the
inability to pass the name as an argument.
|
In Fortran 2008, you can use designator%RE
to access the real part of complex numbers directly; for instance,
A%RE has the same value as REAL(A). For more information about complex
part designators, see Complex.