real(x [, kind])
converts its argument x
to a real type.
FORTRAN 77 and later
Elemental function
result = real(x [, kind])
x
- Shall be integer
, real
, or complex
.kind
- (Optional) An integer
initialization expression indicating the kind parameter of the result.These functions return a real
variable or array under the following rules:
real(x)
is converted to a default real type if x
is an integer or real variable.
real(x)
is converted to a real type with the kind type parameter of x
if x
is a complex variable.
real(x, kind)
is converted to a real type with kind type parameter kind
if x
is a complex, integer, or real variable.
program test_real
complex :: x = (1.0, 2.0)
print *, real(x), real(x,8)
end program test_real