1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
4 // Public Domain C Library - http://pdclib.sourceforge.net
5 // This code is Public Domain. Use, modify, and redistribute at will.
6 // ----------------------------------------------------------------------------
7 // Provides the types float _Complex, double _Complex and long double _Complex
8 // plus math functions on those types.
9 // ----------------------------------------------------------------------------
12 #define __COMPLEX_H __COMPLEX_H
14 // ----------------------------------------------------------------------------
17 // TODO: #defines for complex, _Complex_I, imaginary, _Imaginary_I, and I.
19 // ----------------------------------------------------------------------------
24 // These functions return the absolute value (magnitude) of their parameter.
25 double abs( double _Complex x );
26 float abs( float _Complex x );
27 long double abs( long double _Complex x );
28 double fabs( double _Complex x );
29 float fabs( float _Complex x );
30 long double fabs( long double _Complex x );
32 // These functions return the sine of their parameter.
33 double _Complex sin( double _Complex x );
34 float _Complex sin( float _Complex x );
35 long double _Complex sin( long double _Complex x );
37 // These functions return the hyperbolic sine of their parameter.
38 double _Complex sinh( double _Complex x );
39 float _Complex sinh( float _Complex x );
40 long double _Complex sinh( long double _Complex x );
42 // These functions return the arcsine of their parameter.
43 double _Complex asin( double _Complex x );
44 float _Complex asin( float _Complex x );
45 long double _Complex asin( long double _Complex x );
47 // These functions return the hyperbolic arcsine of their parameter.
48 double _Complex asinh( double _Complex x );
49 float _Complex asinh( float _Complex x );
50 long double _Complex asinh( long double _Complex x );
52 // These functions return the cosine of their parameter.
53 double _Complex cos( double _Complex x );
54 float _Complex cos( float _Complex x );
55 long double _Complex cos( long double _Complex x );
57 // These functions return the hyperbolic cosine of their parameter.
58 double _Complex cosh( double _Complex x );
59 float _Complex cosh( float _Complex x );
60 long double _Complex cosh( long double _Complex x );
62 // These functions return the arccosine of their parameter.
63 double _Complex acos( double _Complex x );
64 float _Complex acos( float _Complex x );
65 long double _Complex acos( long double _Complex x );
67 // These functions return the hyperbolic arccosine of their parameter.
68 double _Complex acosh( double _Complex x );
69 float _Complex acosh( float _Complex x );
70 long double _Complex acosh( long double _Complex x );
72 // These functions return the tangent of their parameter.
73 double _Complex tan( double _Complex x );
74 float _Complex tan( float _Complex x );
75 long double _Complex tan( long double _Complex x );
77 // These functions return the hyperbolic tangent of their parameter.
78 double _Complex tanh( double _Complex x );
79 float _Complex tanh( float _Complex x );
80 long double _Complex tanh( long double _Complex x );
82 // These functions return the arctangent of their parameter.
83 double _Complex atan( double _Complex x );
84 float _Complex atan( float _Complex x );
85 long double _Complex atan( long double _Complex x );
87 // These functions return the hyperbolic arctangent of their parameter.
88 double _Complex atanh( double _Complex x );
89 float _Complex atanh( float _Complex x );
90 long double _Complex atanh( long double _Complex x );
92 // These functions return the imaginary part of their parameter.
93 double imag( double _Complex x );
94 float imag( float _Complex x );
95 long double imag( long double _Complex x );
96 float cimag( float _Complex x );
97 long double cimag( long double _Complex x );
99 // These functions return the real part of their parameter.
100 double real( double _Complex x );
101 float real( float _Complex x );
102 long double real( long double _Complex x );
103 float creal( float _Complex x );
104 long double creal( long double _Complex x );
106 // These functions return value^exponent.
107 double _Complex pow( double _Complex value,
108 double _Complex exponent );
109 float _Complex pow( float _Complex value,
110 float _Complex exponent );
111 long double _Complex pow( long double _Complex value,
112 long double _Complex exponent );
114 // These functions return the square root of their parameter.
115 double _Complex sqrt( double _Complex x );
116 float _Complex sqrt( float _Complex x );
117 long double _Complex sqrt( long double _Complex x );
119 // These functions return the exponential of their parameter.
120 double _Complex exp( double _Complex x );
121 float _Complex exp( float _Complex x );
122 long double _Complex exp( long double _Complex x );
124 // These functions return the logarithm of their parameter.
125 double _Complex log( double _Complex x );
126 float _Complex log( float _Complex x );
127 long double _Complex log( long double _Complex x );
129 // These functions return the phase angle of their parameter.
130 double arg( double _Complex x );
131 float arg( float _Complex x );
132 long double arg( long double _Complex x );
133 float carg( float _Complex x );
134 long double carg( long double _Complex x );
136 // These functions return the conjugate of their parameter.
137 float _Complex conj( float _Complex x );
138 long double _Complex conj( long double _Complex x );
140 // These functions return the projection of their parameter.
141 float _Complex cproj( float _Complex x );
142 long double _Complex cproj( long double _Complex x );
144 #endif // __cplusplus
146 // ----------------------------------------------------------------------------
147 // FUNCTIONS - Standard C
149 // These functions return the absolute value (magnitude) of their parameter.
150 double cabs( double _Complex x );
151 float cabsf( float _Complex x );
152 long double cabsl( long double _Complex x );
154 // These functions return the sine of their parameter.
155 double _Complex csin( double _Complex x );
156 float _Complex csinf( float _Complex x );
157 long double _Complex csinl( long double _Complex x );
159 // These functions return the hyperbolic sine of their parameter.
160 double _Complex csinh( double _Complex x );
161 float _Complex csinhf( float _Complex x );
162 long double _Complex csinhl( long double _Complex x );
164 // These functions return the arcsine of their parameter.
165 double _Complex casin( double _Complex x );
166 float _Complex casinf( float _Complex x );
167 long double _Complex casinl( long double _Complex x );
169 // These functions return the hyperbolic arcsine of their parameter.
170 double _Complex casinh( double _Complex x );
171 float _Complex casinhf( float _Complex x );
172 long double _Complex casinhl( long double _Complex x );
174 // These functions return the cosine of their parameter.
175 double _Complex ccos( double _Complex x );
176 float _Complex ccosf( float _Complex x );
177 long double _Complex ccosl( long double _Complex x );
179 // These functions return the hyperbolic cosine of their parameter.
180 double _Complex ccosh( double _Complex x );
181 float _Complex ccoshf( float _Complex x );
182 long double _Complex ccoshl( long double _Complex x );
184 // These functions return the arccosine of their parameter.
185 double _Complex cacos( double _Complex x );
186 float _Complex cacosf( float _Complex x );
187 long double _Complex cacosl( long double _Complex x );
189 // These functions return the hyperbolic arccosine of their parameter.
190 double _Complex cacosh( double _Complex x );
191 float _Complex cacoshf( float _Complex x );
192 long double _Complex cacoshl( long double _Complex x );
194 // These functions return the tangent of their parameter.
195 double _Complex ctan( double _Complex x );
196 float _Complex ctanf( float _Complex x );
197 long double _Complex ctanl( long double _Complex x );
199 // These functions return the hyperbolic tangent of their parameter.
200 double _Complex ctanh( double _Complex x );
201 float _Complex ctanhf( float _Complex x );
202 long double _Complex ctanhl( long double _Complex x );
204 // These functions return the arctangent of their parameter.
205 double _Complex catan( double _Complex x );
206 float _Complex catanf( float _Complex x );
207 long double _Complex catanl( long double _Complex x );
209 // These functions return the hyperbolic arctangent of their parameter.
210 double _Complex catanh( double _Complex x );
211 float _Complex catanhf( float _Complex x );
212 long double _Complex catanhl( long double _Complex x );
214 // These functions return the imaginary part of their parameter.
215 double cimag( double _Complex x );
216 float cimagf( float _Complex x );
217 long double cimagl( long double _Complex x );
219 // These functions return the real part of their parameter.
220 double creal( double _Complex x );
221 float crealf( float _Complex x );
222 long double creall( long double _Complex x );
224 // These functions return value^exponent.
225 double _Complex cpow( double _Complex value,
226 double _Complex exponent );
227 float _Complex cpowf( float _Complex value,
228 float _Complex exponent );
229 long double _Complex cpowl( long double _Complex value,
230 long double _Complex exponent );
232 // These functions return the square root of their parameter.
233 double _Complex csqrt( double _Complex x );
234 float _Complex csqrtf( float _Complex x );
235 long double _Complex csqrtl( long double _Complex x );
237 // These functions return the exponential of their parameter.
238 double _Complex cexp( double _Complex x );
239 float _Complex cexpf( float _Complex x );
240 long double _Complex cexpl( long double _Complex x );
242 // These functions return the logarithm of their parameter.
243 double _Complex clog( double _Complex x );
244 float _Complex clogf( float _Complex x );
245 long double _Complex clogl( long double _Complex x );
247 // These functions return the phase angle of their value.
248 double carg( double _Complex x );
249 float cargf( float _Complex x );
250 long double cargl( long double _Complex x );
252 // These functions return the conjugate of their parameter.
253 double _Complex conj( double _Complex x );
254 float _Complex conjf( float _Complex x );
255 long double _Complex conjl( long double _Complex x );
257 // These functions return the projection of their parameter.
258 double _Complex cproj( double _Complex x );
259 float _Complex cprojf( float _Complex x );
260 long double _Complex cprojl( long double _Complex x );
262 #endif // __COMPLEX_H