Lahey/Fujitsu Fortran

REAL Function


The REAL function converts a number to a REAL data type.


REAL (a [, kind] )

Required Arguments

a is an INTENT(IN) scalar or array of any numeric type.

Optional Arguments

kind is INTENT(IN) and determines the kind of the result. It must be a scalar INTEGER expression that can be evaluated at compile time. To maintain portability, this argument should be the result of a KIND Function or SELECTED_REAL_KIND Function.


The result is of type REAL. Its value is a REAL representation of a

If kind is present, it determines the kind of the result.

If a is of type COMPLEX, the result's value is the real part of a.


integer :: i=10. real :: a=2.5 complex :: c=(1.5,2.5) write(*,*) i,real(i) ! convert integer to real write(*,*) a,real(a,kind(1.d0)) ! convert between real kinds write(*,*) c,real(c) ! return real part


KIND Function