1 /**
2  * This file has no copyright assigned and is placed in the Public Domain.
3  * This file is part of the mingw-w64 runtime package.
4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5  */
6 /*
7  * complex.h
8  *
9  * This file is part of the Mingw32 package.
10  *
11  * Contributors:
12  *  Created by Danny Smith <[email protected]>
13  *
14  *  THIS SOFTWARE IS NOT COPYRIGHTED
15  *
16  *  This source code is offered for use in the public domain. You may
17  *  use, modify or distribute it freely.
18  *
19  *  This code is distributed in the hope that it will be useful but
20  *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
21  *  DISCLAIMED. This includes but is not limited to warranties of
22  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23  *
24  */
25 
26 #ifndef _COMPLEX_H_
27 #define _COMPLEX_H_
28 
29 /* All the headers include this file. */
30 #include <crtdefs.h>
31 
32 /* These macros are specified by C99 standard */
33 
34 #ifndef __cplusplus
35 #define complex _Complex
36 #endif
37 
38 #define _Complex_I  (__extension__  1.0iF)
39 
40 /* GCC doesn't support _Imaginary type yet, so we don't
41    define _Imaginary_I */
42 
43 #define I _Complex_I
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 #ifndef RC_INVOKED
50 
51 double __MINGW_ATTRIB_CONST creal (double _Complex);
52 double __MINGW_ATTRIB_CONST cimag (double _Complex);
53 double __MINGW_ATTRIB_CONST carg (double _Complex);
54 double __MINGW_ATTRIB_CONST cabs (double _Complex) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
55 double _Complex __MINGW_ATTRIB_CONST conj (double _Complex);
56 double _Complex  cacos (double _Complex);
57 double _Complex  casin (double _Complex);
58 double _Complex  catan (double _Complex);
59 double _Complex  ccos (double _Complex);
60 double _Complex  csin (double _Complex);
61 double _Complex  ctan (double _Complex);
62 double _Complex  cacosh (double _Complex);
63 double _Complex  casinh (double _Complex);
64 double _Complex  catanh (double _Complex);
65 double _Complex  ccosh (double _Complex);
66 double _Complex  csinh (double _Complex);
67 double _Complex  ctanh (double _Complex);
68 double _Complex  cexp (double _Complex);
69 double _Complex  clog (double _Complex);
70 #ifdef _GNU_SOURCE
71 double _Complex  clog10(double _Complex);
72 #endif  /* _GNU_SOURCE */
73 double _Complex  cpow (double _Complex, double _Complex);
74 double _Complex  csqrt (double _Complex);
75 double _Complex __MINGW_ATTRIB_CONST cproj (double _Complex);
76 
77 float __MINGW_ATTRIB_CONST crealf (float _Complex);
78 float __MINGW_ATTRIB_CONST cimagf (float _Complex);
79 float __MINGW_ATTRIB_CONST cargf (float _Complex);
80 float __MINGW_ATTRIB_CONST cabsf (float _Complex);
81 float _Complex __MINGW_ATTRIB_CONST conjf (float _Complex);
82 float _Complex  cacosf (float _Complex);
83 float _Complex  casinf (float _Complex);
84 float _Complex  catanf (float _Complex);
85 float _Complex  ccosf (float _Complex);
86 float _Complex  csinf (float _Complex);
87 float _Complex  ctanf (float _Complex);
88 float _Complex  cacoshf (float _Complex);
89 float _Complex  casinhf (float _Complex);
90 float _Complex  catanhf (float _Complex);
91 float _Complex  ccoshf (float _Complex);
92 float _Complex  csinhf (float _Complex);
93 float _Complex  ctanhf (float _Complex);
94 float _Complex  cexpf (float _Complex);
95 float _Complex  clogf (float _Complex);
96 #ifdef _GNU_SOURCE
97 float _Complex  clog10f(float _Complex);
98 #endif  /* _GNU_SOURCE */
99 float _Complex  cpowf (float _Complex, float _Complex);
100 float _Complex  csqrtf (float _Complex);
101 float _Complex __MINGW_ATTRIB_CONST cprojf (float _Complex);
102 
103 long double __MINGW_ATTRIB_CONST creall (long double _Complex);
104 long double __MINGW_ATTRIB_CONST cimagl (long double _Complex);
105 long double __MINGW_ATTRIB_CONST cargl (long double _Complex);
106 long double __MINGW_ATTRIB_CONST cabsl (long double _Complex);
107 long double _Complex __MINGW_ATTRIB_CONST conjl (long double _Complex);
108 long double _Complex  cacosl (long double _Complex);
109 long double _Complex  casinl (long double _Complex);
110 long double _Complex  catanl (long double _Complex);
111 long double _Complex  ccosl (long double _Complex);
112 long double _Complex  csinl (long double _Complex);
113 long double _Complex  ctanl (long double _Complex);
114 long double _Complex  cacoshl (long double _Complex);
115 long double _Complex  casinhl (long double _Complex);
116 long double _Complex  catanhl (long double _Complex);
117 long double _Complex  ccoshl (long double _Complex);
118 long double _Complex  csinhl (long double _Complex);
119 long double _Complex  ctanhl (long double _Complex);
120 long double _Complex  cexpl (long double _Complex);
121 long double _Complex  clogl (long double _Complex);
122 #ifdef _GNU_SOURCE
123 long double _Complex  clog10l(long double _Complex);
124 #endif  /* _GNU_SOURCE */
125 long double _Complex  cpowl (long double _Complex, long double _Complex);
126 long double _Complex  csqrtl (long double _Complex);
127 long double _Complex __MINGW_ATTRIB_CONST cprojl (long double _Complex);
128 
129 #ifdef __GNUC__
130 #if !defined (__CRT__NO_INLINE) && defined (_MATH_H_)
131 /* double */
creal(double _Complex _Z)132 __CRT_INLINE double __MINGW_ATTRIB_CONST creal (double _Complex _Z)
133 {
134   return __real__ _Z;
135 }
136 
cimag(double _Complex _Z)137 __CRT_INLINE double __MINGW_ATTRIB_CONST cimag (double _Complex _Z)
138 {
139   return __imag__ _Z;
140 }
141 
conj(double _Complex _Z)142 __CRT_INLINE double _Complex __MINGW_ATTRIB_CONST conj (double _Complex _Z)
143 {
144   return __extension__ ~_Z;
145 }
146 
carg(double _Complex _Z)147 __CRT_INLINE  double __MINGW_ATTRIB_CONST carg (double _Complex _Z)
148 {
149   return atan2 (__imag__ _Z, __real__ _Z);
150 }
151 
cabs(double _Complex _Z)152 __CRT_INLINE double __MINGW_ATTRIB_CONST cabs (double _Complex _Z)
153 {
154   return hypot (__real__ _Z, __imag__ _Z);
155 }
156 
157 /* float */
crealf(float _Complex _Z)158 __CRT_INLINE float __MINGW_ATTRIB_CONST crealf (float _Complex _Z)
159 {
160   return __real__ _Z;
161 }
162 
cimagf(float _Complex _Z)163 __CRT_INLINE float __MINGW_ATTRIB_CONST cimagf (float _Complex _Z)
164 {
165   return __imag__ _Z;
166 }
167 
conjf(float _Complex _Z)168 __CRT_INLINE float _Complex __MINGW_ATTRIB_CONST conjf (float _Complex _Z)
169 {
170   return __extension__ ~_Z;
171 }
172 
cargf(float _Complex _Z)173 __CRT_INLINE  float __MINGW_ATTRIB_CONST cargf (float _Complex _Z)
174 {
175   return atan2f (__imag__ _Z, __real__ _Z);
176 }
177 
cabsf(float _Complex _Z)178 __CRT_INLINE float __MINGW_ATTRIB_CONST cabsf (float _Complex _Z)
179 {
180   return hypotf (__real__ _Z, __imag__ _Z);
181 }
182 
183 /* long double */
creall(long double _Complex _Z)184 __CRT_INLINE long double __MINGW_ATTRIB_CONST creall (long double _Complex _Z)
185 {
186   return __real__ _Z;
187 }
188 
cimagl(long double _Complex _Z)189 __CRT_INLINE long double __MINGW_ATTRIB_CONST cimagl (long double _Complex _Z)
190 {
191   return __imag__ _Z;
192 }
193 
conjl(long double _Complex _Z)194 __CRT_INLINE long double _Complex __MINGW_ATTRIB_CONST conjl (long double _Complex _Z)
195 {
196   return __extension__ ~_Z;
197 }
198 
cargl(long double _Complex _Z)199 __CRT_INLINE  long double __MINGW_ATTRIB_CONST cargl (long double _Complex _Z)
200 {
201   return atan2l (__imag__ _Z, __real__ _Z);
202 }
203 
cabsl(long double _Complex _Z)204 __CRT_INLINE long double __MINGW_ATTRIB_CONST cabsl (long double _Complex _Z)
205 {
206   return hypotl (__real__ _Z, __imag__ _Z);
207 }
208 #endif /* !__CRT__NO_INLINE */
209 #endif /* __GNUC__ */
210 
211 
212 #endif /* RC_INVOKED */
213 
214 #ifdef __cplusplus
215 }
216 #endif
217 
218 #endif /* _COMPLEX_H */
219