this repo has no description
1.\" Copyright (c) 2006 Apple Computer
2.\"
3.Dd December 11, 2006
4.Dt COMPLEX 3
5.Os
6.Sh NAME
7.Nm complex
8.Nd complex floating-point functions
9.Sh SYNOPSIS
10.Fd #include <complex.h>
11.Sh DESCRIPTION
12The header file complex.h provides function prototypes and macros for working with C99 complex
13floating-point values. The functions conform to the ISO/IEC 9899:1999(E) standard. In particular,
14arguments with infinite real or imaginary parts are regarded as infinities, even if the other
15part is a NaN.
16.Pp
17complex.h defines the macro
18.Fa complex
19for use as a type specifier, and the macro
20.Fa I
21to be the imaginary unit, which can be used to construct complex
22floating-point numbers from two real floating-point numbers. For example:
23.Bd -literal -offset indent
24#include <complex.h>
25double complex z = 1.0 + 1.0 * I; // z = 1 + i
26.Ed
27.Pp
28Each of the functions that use complex floating-point values are provided in single, double,
29and extended precision; the double precision prototypes are listed here. The man pages for the
30individual functions provide more details on their use, special cases, and prototypes for their
31single and extended precision versions.
32.Pp
33The double-precision functions defined in complex.h are:
34.Pp
35.Ft double
36.Fn creal "double complex z"
37.Pp
38.Ft double
39.Fn cimag "double complex z"
40.Pp
41.Fn creal
42and
43.Fn cimag
44take a complex floating-point number and return its real and imaginary part,
45respectively, as real floating-point numbers.
46.Pp
47.Ft double
48.Fn cabs "double complex z"
49.Pp
50.Ft double
51.Fn carg "double complex z"
52.Pp
53.Fn cabs
54and
55.Fn carg
56take a complex floating-point number and return its norm and argument (phase angle),
57respectively, as real floating-point numbers. They are used to convert between
58rectangular and polar coordinates, and are fully specified in terms of real functions:
59.Bd -literal -offset indent
60cabs(x + iy) = hypot(x,y)
61.br
62carg(x + iy) = atan2(y,x)
63.Ed
64.Pp
65.Ft double complex
66.Fn conj "double complex z"
67.Pp
68.Fn conj
69takes a complex floating-point number and returns its complex conjugate.
70.Pp
71.Ft double complex
72.Fn cproj "double complex z"
73.Pp
74.Fn cproj
75takes a complex floating-point number and returns its projection onto the
76Riemann sphere, as defined in C99. For non-infinite inputs, the return value is
77equal to the input value.
78.Pp
79.Ft double complex
80.Fn csqrt "double complex z"
81.Pp
82.Fn csqrt
83takes a complex floating-point number and returns its square root, with a branch cut on
84the negative real axis.
85.Pp
86.Ft double complex
87.Fn cexp "double complex z"
88.Pp
89.Ft double complex
90.Fn clog "double complex z"
91.Pp
92.Fn cexp
93and
94.Fn clog
95take a complex floating-point number and return its base-e exponential and logarithm,
96respectively.
97.Fn clog
98has a branch cut on the negative real axis.
99.Pp
100.Ft double complex
101.Fn cpow "double complex z" "double complex w"
102.Pp
103.Fn cpow
104takes two complex floating-point numbers, and returns the first raised to the power of the second,
105with a branch cut for the first parameter along the negative real axis.
106.Pp
107.Ft double complex
108.Fn csin "double complex z"
109.Pp
110.Ft double complex
111.Fn ccos "double complex z"
112.Pp
113.Ft double complex
114.Fn ctan "double complex z"
115.Pp
116.Fn csin ,
117.Fn ccos ,
118and
119.Fn ctan
120take a complex floating-point number and return its sine, cosine, and tangent, respectively.
121.Pp
122.Ft double complex
123.Fn casin "double complex z"
124.Pp
125.Ft double complex
126.Fn cacos "double complex z"
127.Pp
128.Ft double complex
129.Fn catan "double complex z"
130.Pp
131.Fn casin ,
132.Fn cacos ,
133and
134.Fn catan
135take a complex floating-point number and return its inverse sine, cosine, and tangent, respectively.
136.Pp
137.Fn casin
138and
139.Fn cacos
140have branch cuts outside the interval
141.Bq -1, 1
142on the real axis,
143and
144.Fn catan
145has a branch cut outside the interval
146.Bq -i, i
147on the imaginary axis.
148.Pp
149.Ft double complex
150.Fn csinh "double complex z"
151.Pp
152.Ft double complex
153.Fn ccosh "double complex z"
154.Pp
155.Ft double complex
156.Fn ctanh "double complex z"
157.Pp
158.Fn csinh ,
159.Fn ccosh ,
160and
161.Fn ctanh
162take a complex floating-point number and return its hyperbolic sine, cosine, and tangent, respectively.
163.Pp
164.Ft double complex
165.Fn casinh "double complex z"
166.Pp
167.Ft double complex
168.Fn cacosh "double complex z"
169.Pp
170.Ft double complex
171.Fn catanh "double complex z"
172.Pp
173.Fn casinh ,
174.Fn cacosh ,
175and
176.Fn catanh
177take a complex floating-point number and return its inverse hyperbolic sine, cosine, and tangent, respectively.
178.Pp
179.Fn casinh
180has a branch cut outside the interval
181.Bq -i, i
182on the imaginary axis.
183.Fn cacosh
184has a branch cut at values less than 1 on the real axis.
185.Fn catanh
186has a branch cut outside the interval
187.Bq -1, 1
188on the real axis.
189.Sh NOTE
190Note that the complex math functions are not, in general, equivalent to their real counterparts for inputs on the
191real axis. For example, csqrt(-1 + 0i) is 0 + i, whereas sqrt(-1) is NaN.
192.Sh SEE ALSO
193.Xr cabs 3 ,
194.Xr cacos 3 ,
195.Xr cacosh 3 ,
196.Xr carg 3 ,
197.Xr casin 3 ,
198.Xr casinh 3 ,
199.Xr catan 3 ,
200.Xr catanh 3 ,
201.Xr ccos 3 ,
202.Xr ccosh 3 ,
203.Xr cexp 3 ,
204.Xr cimag 3 ,
205.Xr clog 3 ,
206.Xr conj 3 ,
207.Xr cpow 3 ,
208.Xr cproj 3 ,
209.Xr creal 3 ,
210.Xr csin 3 ,
211.Xr csinh 3 ,
212.Xr csqrt 3 ,
213.Xr ctan 3 ,
214.Xr ctanh 3 ,
215.Xr math 3
216.Sh STANDARDS
217The <complex.h> functions conform to ISO/IEC 9899:1999(E).