1 /* ----------------------------------------------------------------------------
3 * ----------------------------------------------------------------------------
4 * Public Domain C Library - http://pdclib.sourceforge.net
5 * This code is Public Domain. Use, modify, and redistribute at will.
6 * ----------------------------------------------------------------------------
8 * --------------------------------------------------------------------------*/
11 #define _COMPLEX_H _COMPLEX_H
14 #define _PERSONALITY _PERSONALITY
15 #include "__personality.h"
16 #endif /* _PERSONALITY */
18 /* ----------------------------------------------------------------------------
20 * --------------------------------------------------------------------------*/
23 #define complex _Complex
26 #define _Complex_I ( const float _Complex ) { 0, 1 }
28 #ifdef __PERSONALITY_SUPPORTS_IMAGINARY
29 #define imaginary _Imaginary
30 #endif // __PERSONALITY_SUPPORTS_IMAGINARY
33 #define _Imaginary_I ( ( const float _Imaginary ) 1 )
37 #define I _Imaginary_I
42 /* ----------------------------------------------------------------------------
44 * --------------------------------------------------------------------------*/
46 /* These functions return the absolute value (magnitude) of their parameter. */
47 double cabs( double _Complex x );
48 float cabsf( float _Complex x );
49 long double cabsl( long double _Complex x );
51 /* These functions return the sine of their parameter. */
52 double _Complex csin( double _Complex x );
53 float _Complex csinf( float _Complex x );
54 long double _Complex csinl( long double _Complex x );
56 /* These functions return the hyperbolic sine of their parameter. */
57 double _Complex csinh( double _Complex x );
58 float _Complex csinhf( float _Complex x );
59 long double _Complex csinhl( long double _Complex x );
61 /* These functions return the arcsine of their parameter. */
62 double _Complex casin( double _Complex x );
63 float _Complex casinf( float _Complex x );
64 long double _Complex casinl( long double _Complex x );
66 /* These functions return the hyperbolic arcsine of their parameter. */
67 double _Complex casinh( double _Complex x );
68 float _Complex casinhf( float _Complex x );
69 long double _Complex casinhl( long double _Complex x );
71 /* These functions return the cosine of their parameter. */
72 double _Complex ccos( double _Complex x );
73 float _Complex ccosf( float _Complex x );
74 long double _Complex ccosl( long double _Complex x );
76 /* These functions return the hyperbolic cosine of their parameter. */
77 double _Complex ccosh( double _Complex x );
78 float _Complex ccoshf( float _Complex x );
79 long double _Complex ccoshl( long double _Complex x );
81 /* These functions return the arccosine of their parameter. */
82 double _Complex cacos( double _Complex x );
83 float _Complex cacosf( float _Complex x );
84 long double _Complex cacosl( long double _Complex x );
86 /* These functions return the hyperbolic arccosine of their parameter. */
87 double _Complex cacosh( double _Complex x );
88 float _Complex cacoshf( float _Complex x );
89 long double _Complex cacoshl( long double _Complex x );
91 /* These functions return the tangent of their parameter. */
92 double _Complex ctan( double _Complex x );
93 float _Complex ctanf( float _Complex x );
94 long double _Complex ctanl( long double _Complex x );
96 /* These functions return the hyperbolic tangent of their parameter. */
97 double _Complex ctanh( double _Complex x );
98 float _Complex ctanhf( float _Complex x );
99 long double _Complex ctanhl( long double _Complex x );
101 /* These functions return the arctangent of their parameter. */
102 double _Complex catan( double _Complex x );
103 float _Complex catanf( float _Complex x );
104 long double _Complex catanl( long double _Complex x );
106 /* These functions return the hyperbolic arctangent of their parameter. */
107 double _Complex catanh( double _Complex x );
108 float _Complex catanhf( float _Complex x );
109 long double _Complex catanhl( long double _Complex x );
111 /* These functions return the imaginary part of their parameter. */
112 double cimag( double _Complex x );
113 float cimagf( float _Complex x );
114 long double cimagl( long double _Complex x );
116 /* These functions return the real part of their parameter. */
117 double creal( double _Complex x );
118 float crealf( float _Complex x );
119 long double creall( long double _Complex x );
121 /* These functions return x^y. */
122 double _Complex cpow( double _Complex x, double _Complex y );
123 float _Complex cpowf( float _Complex x, float _Complex y );
124 long double _Complex cpowl( long double _Complex x, long double _Complex y );
126 /* These functions return the square root of their parameter. */
127 double _Complex csqrt( double _Complex x );
128 float _Complex csqrtf( float _Complex x );
129 long double _Complex csqrtl( long double _Complex x );
131 /* These functions return the exponential of their parameter. */
132 double _Complex cexp( double _Complex x );
133 float _Complex cexpf( float _Complex x );
134 long double _Complex cexpl( long double _Complex x );
136 /* These functions return the logarithm of their parameter. */
137 double _Complex clog( double _Complex x );
138 float _Complex clogf( float _Complex x );
139 long double _Complex clogl( long double _Complex x );
141 /* These functions return the phase angle of their value. */
142 double carg( double _Complex x );
143 float cargf( float _Complex x );
144 long double cargl( long double _Complex x );
146 /* These functions return the conjugate of their parameter. */
147 double _Complex conj( double _Complex x );
148 float _Complex conjf( float _Complex x );
149 long double _Complex conjl( long double _Complex x );
151 /* These functions return the projection of their parameter. */
152 double _Complex cproj( double _Complex x );
153 float _Complex cprojf( float _Complex x );
154 long double _Complex cprojl( long double _Complex x );
156 #endif /* _COMPLEX_H */