1complex.h(0P) POSIX Programmer's Manual complex.h(0P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 complex.h — complex arithmetic
13
15 #include <complex.h>
16
18 The functionality described on this reference page is aligned with the
19 ISO C standard. Any conflict between the requirements described here
20 and the ISO C standard is unintentional. This volume of POSIX.1‐2017
21 defers to the ISO C standard.
22
23 The <complex.h> header shall define the following macros:
24
25 complex Expands to _Complex.
26
27 _Complex_I Expands to a constant expression of type const float _Com‐
28 plex, with the value of the imaginary unit (that is, a num‐
29 ber i such that i2=-1).
30
31 imaginary Expands to _Imaginary.
32
33 _Imaginary_I
34 Expands to a constant expression of type const float _Imag‐
35 inary with the value of the imaginary unit.
36
37 I Expands to either _Imaginary_I or _Complex_I. If _Imagi‐
38 nary_I is not defined, I expands to _Complex_I.
39
40 The macros imaginary and _Imaginary_I shall be defined if and only if
41 the implementation supports imaginary types.
42
43 An application may undefine and then, perhaps, redefine the complex,
44 imaginary, and I macros.
45
46 The following shall be declared as functions and may also be defined as
47 macros. Function prototypes shall be provided.
48
49
50 double cabs(double complex);
51 float cabsf(float complex);
52 long double cabsl(long double complex);
53 double complex cacos(double complex);
54 float complex cacosf(float complex);
55 double complex cacosh(double complex);
56 float complex cacoshf(float complex);
57 long double complex cacoshl(long double complex);
58 long double complex cacosl(long double complex);
59 double carg(double complex);
60 float cargf(float complex);
61 long double cargl(long double complex);
62 double complex casin(double complex);
63 float complex casinf(float complex);
64 double complex casinh(double complex);
65 float complex casinhf(float complex);
66 long double complex casinhl(long double complex);
67 long double complex casinl(long double complex);
68 double complex catan(double complex);
69 float complex catanf(float complex);
70 double complex catanh(double complex);
71 float complex catanhf(float complex);
72 long double complex catanhl(long double complex);
73 long double complex catanl(long double complex);
74 double complex ccos(double complex);
75 float complex ccosf(float complex);
76 double complex ccosh(double complex);
77 float complex ccoshf(float complex);
78 long double complex ccoshl(long double complex);
79 long double complex ccosl(long double complex);
80 double complex cexp(double complex);
81 float complex cexpf(float complex);
82 long double complex cexpl(long double complex);
83 double cimag(double complex);
84 float cimagf(float complex);
85 long double cimagl(long double complex);
86 double complex clog(double complex);
87 float complex clogf(float complex);
88 long double complex clogl(long double complex);
89 double complex conj(double complex);
90 float complex conjf(float complex);
91 long double complex conjl(long double complex);
92 double complex cpow(double complex, double complex);
93 float complex cpowf(float complex, float complex);
94 long double complex cpowl(long double complex, long double complex);
95 double complex cproj(double complex);
96 float complex cprojf(float complex);
97 long double complex cprojl(long double complex);
98 double creal(double complex);
99 float crealf(float complex);
100 long double creall(long double complex);
101 double complex csin(double complex);
102 float complex csinf(float complex);
103 double complex csinh(double complex);
104 float complex csinhf(float complex);
105 long double complex csinhl(long double complex);
106 long double complex csinl(long double complex);
107 double complex csqrt(double complex);
108 float complex csqrtf(float complex);
109 long double complex csqrtl(long double complex);
110 double complex ctan(double complex);
111 float complex ctanf(float complex);
112 double complex ctanh(double complex);
113 float complex ctanhf(float complex);
114 long double complex ctanhl(long double complex);
115 long double complex ctanl(long double complex);
116
117 The following sections are informative.
118
120 Values are interpreted as radians, not degrees.
121
123 The choice of I instead of i for the imaginary unit concedes to the
124 widespread use of the identifier i for other purposes. The application
125 can use a different identifier, say j, for the imaginary unit by fol‐
126 lowing the inclusion of the <complex.h> header with:
127
128
129 #undef I
130 #define j _Imaginary_I
131
132 An I suffix to designate imaginary constants is not required, as multi‐
133 plication by I provides a sufficiently convenient and more generally
134 useful notation for imaginary terms. The corresponding real type for
135 the imaginary unit is float, so that use of I for algorithmic or nota‐
136 tional convenience will not result in widening types.
137
138 On systems with imaginary types, the application has the ability to
139 control whether use of the macro I introduces an imaginary type, by
140 explicitly defining I to be _Imaginary_I or _Complex_I. Disallowing
141 imaginary types is useful for some applications intended to run on
142 implementations without support for such types.
143
144 The macro _Imaginary_I provides a test for whether imaginary types are
145 supported.
146
147 The cis() function (cos(x) + I*sin(x)) was considered but rejected
148 because its implementation is easy and straightforward, even though
149 some implementations could compute sine and cosine more efficiently in
150 tandem.
151
153 The following function names and the same names suffixed with f or l
154 are reserved for future use, and may be added to the declarations in
155 the <complex.h> header.
156
157
158 cerf() cexpm1() clog2()
159 cerfc() clog10() clgamma()
160 cexp2() clog1p() ctgamma()
161
163 The System Interfaces volume of POSIX.1‐2017, cabs(), cacos(),
164 cacosh(), carg(), casin(), casinh(), catan(), catanh(), ccos(),
165 ccosh(), cexp(), cimag(), clog(), conj(), cpow(), cproj(), creal(),
166 csin(), csinh(), csqrt(), ctan(), ctanh()
167
169 Portions of this text are reprinted and reproduced in electronic form
170 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
171 table Operating System Interface (POSIX), The Open Group Base Specifi‐
172 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
173 Electrical and Electronics Engineers, Inc and The Open Group. In the
174 event of any discrepancy between this version and the original IEEE and
175 The Open Group Standard, the original IEEE and The Open Group Standard
176 is the referee document. The original Standard can be obtained online
177 at http://www.opengroup.org/unix/online.html .
178
179 Any typographical or formatting errors that appear in this page are
180 most likely to have been introduced during the conversion of the source
181 files to man page format. To report such errors, see https://www.ker‐
182 nel.org/doc/man-pages/reporting_bugs.html .
183
184
185
186IEEE/The Open Group 2017 complex.h(0P)