aimag(x): Imaginary Part

Imaginary part of complex number.

Declaración

Sintaxis

retval = aimag(x)
elemental real(sp) function aimag(x)
elemental real(dp) function aimag(x)

Argumentos

x the input value must be of complex type.

Valores devueltos

The return value is imaginary part of type real and kind same as of x.

Descripción

aimag(x) returns the imaginary part of the input complex argument x.

For x complex input value, the result is calculated using mathematical formula:

\(x + iy\)

\(i\) the imaginary part is the result.

Tipos

Supported argument types are complex.

interface aimag
    module procedure saimag, daimag
end interface

contains

elemental real(sp) function saimag(x)
complex(sp), intent(in) :: x
end function

elemental real(dp) function daimag(x)
complex(dp), intent(in) :: x
end function

Ejemplos

program intrinsics_aimag
    implicit none
	print *, aimag(1.0, -3.0)
end program

Result:

-3.0

Ver también

ceiling, floor.