Debian Codegraph @

doc/src/intrinsics/numeric/aimag.md

raw
1 # aimag(x): Imaginary Part
2
3 Imaginary part of complex number.
4
5 ## Declaration
6
7 ### Syntax
8
9 ```fortran
10 retval = aimag(x)
11 elemental real(sp) function aimag(x)
12 elemental real(dp) function aimag(x)
13 ```
14
15 ### Arguments
16
17 `x` the input value must be of complex type.
18
19 ### Return values
20
21 The return value is imaginary part of type real and kind same as of `x`.
22
23 ## Description
24
25 **aimag(x)** returns the imaginary part of the input complex argument `x`.
26
27 For `x` complex input value, the result is calculated using mathematical formula:
28
29 $x + iy$
30
31 $i$ the imaginary part is the result.
32
33 ## Types
34
35 Supported argument types are complex.
36
37 ```fortran
38 interface aimag
39 module procedure saimag, daimag
40 end interface
41
42 contains
43
44 elemental real(sp) function saimag(x)
45 complex(sp), intent(in) :: x
46 end function
47
48 elemental real(dp) function daimag(x)
49 complex(dp), intent(in) :: x
50 end function
51 ```
52
53 ## Examples
54
55 ```fortran
56 program intrinsics_aimag
57 implicit none
58 print *, aimag(1.0, -3.0)
59 end program
60 ```
61
62 **Result:**
63
64 ```
65 -3.0
66 ```
67
68 ## See Also
69
70 [ceiling](ceiling.md), [floor](floor.md).