Clicky

Fortran Wiki
real

Description

real(x [, kind]) converts its argument x to a real type.

Standard

FORTRAN 77 and later

Class

Elemental function

Syntax

  • result = real(x [, kind])

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:

  1. real(x) is converted to a default real type if x is an integer or real variable.

  2. real(x) is converted to a real type with the kind type parameter of x if x is a complex variable.

  3. 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)
end program test_real

See also

dble, float

category: intrinsics