aimag(x): Imaginary Part

Imaginary part of complex number.

Declaration

Sintaxe

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 de retorno

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

Descrição

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

Exemplos

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

Resultado:

-3.0

Veja Também

ceiling, floor.