OSDN Git Service

Insert removed author attribution.
[mingw/mingw-org-wsl.git] / include / complex.h
1 /**
2  * @file complex.h
3  * @copy 2012 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  * 
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  * 
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24  /* Created by Danny Smith <dannysmith@users.sourceforge.net> */
25 #ifndef _COMPLEX_H_
26 #define _COMPLEX_H_
27 #pragma GCC system_header
28 #include <_mingw.h>
29
30 /* These macros are specified by C99 standard */
31
32 #ifndef __cplusplus
33 #define complex _Complex
34 #endif
35
36 #define _Complex_I  (0.0F +  1.0iF)
37
38 /* GCC doesn't support _Imaginary type yet, so we don't
39    define _Imaginary_I */
40
41 #define I _Complex_I
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif 
46
47 #ifndef RC_INVOKED
48
49 double __MINGW_ATTRIB_CONST creal (double _Complex);
50 double __MINGW_ATTRIB_CONST cimag (double _Complex);
51 double __MINGW_ATTRIB_CONST carg (double _Complex);
52 double __MINGW_ATTRIB_CONST cabs (double _Complex);
53 double _Complex __MINGW_ATTRIB_CONST conj (double _Complex);
54 double _Complex  cacos (double _Complex);
55 double _Complex  casin (double _Complex);
56 double _Complex  catan (double _Complex);
57 double _Complex  ccos (double _Complex);
58 double _Complex  csin (double _Complex);
59 double _Complex  ctan (double _Complex);
60 double _Complex  cacosh (double _Complex);
61 double _Complex  casinh (double _Complex);
62 double _Complex  catanh (double _Complex);
63 double _Complex  ccosh (double _Complex);
64 double _Complex  csinh (double _Complex);
65 double _Complex  ctanh (double _Complex);
66 double _Complex  cexp (double _Complex);
67 double _Complex  clog (double _Complex);
68 double _Complex  cpow (double _Complex, double _Complex);
69 double _Complex  csqrt (double _Complex);
70 double _Complex __MINGW_ATTRIB_CONST cproj (double _Complex);
71
72 float __MINGW_ATTRIB_CONST crealf (float _Complex);
73 float __MINGW_ATTRIB_CONST cimagf (float _Complex);
74 float __MINGW_ATTRIB_CONST cargf (float _Complex);
75 float __MINGW_ATTRIB_CONST cabsf (float _Complex);
76 float _Complex __MINGW_ATTRIB_CONST conjf (float _Complex);
77 float _Complex  cacosf (float _Complex);
78 float _Complex  casinf (float _Complex);
79 float _Complex  catanf (float _Complex);
80 float _Complex  ccosf (float _Complex);
81 float _Complex  csinf (float _Complex);
82 float _Complex  ctanf (float _Complex);
83 float _Complex  cacoshf (float _Complex);
84 float _Complex  casinhf (float _Complex);
85 float _Complex  catanhf (float _Complex);
86 float _Complex  ccoshf (float _Complex);
87 float _Complex  csinhf (float _Complex);
88 float _Complex  ctanhf (float _Complex);
89 float _Complex  cexpf (float _Complex);
90 float _Complex  clogf (float _Complex);
91 float _Complex  cpowf (float _Complex, float _Complex);
92 float _Complex  csqrtf (float _Complex);
93 float _Complex __MINGW_ATTRIB_CONST cprojf (float _Complex);
94
95 long double __MINGW_ATTRIB_CONST creall (long double _Complex);
96 long double __MINGW_ATTRIB_CONST cimagl (long double _Complex);
97 long double __MINGW_ATTRIB_CONST cargl (long double _Complex);
98 long double __MINGW_ATTRIB_CONST cabsl (long double _Complex);
99 long double _Complex __MINGW_ATTRIB_CONST conjl (long double _Complex);
100 long double _Complex  cacosl (long double _Complex);
101 long double _Complex  casinl (long double _Complex);
102 long double _Complex  catanl (long double _Complex);
103 long double _Complex  ccosl (long double _Complex);
104 long double _Complex  csinl (long double _Complex);
105 long double _Complex  ctanl (long double _Complex);
106 long double _Complex  cacoshl (long double _Complex);
107 long double _Complex  casinhl (long double _Complex);
108 long double _Complex  catanhl (long double _Complex);
109 long double _Complex  ccoshl (long double _Complex);
110 long double _Complex  csinhl (long double _Complex);
111 long double _Complex  ctanhl (long double _Complex);
112 long double _Complex  cexpl (long double _Complex);
113 long double _Complex  clogl (long double _Complex);
114 long double _Complex  cpowl (long double _Complex, long double _Complex);
115 long double _Complex  csqrtl (long double _Complex);
116 long double _Complex __MINGW_ATTRIB_CONST cprojl (long double _Complex);
117
118 /* double */
119 __CRT_INLINE double __MINGW_ATTRIB_CONST creal (double _Complex _Z)
120 {
121   return __real__ _Z;
122 }
123
124 __CRT_INLINE double __MINGW_ATTRIB_CONST cimag (double _Complex _Z)
125 {
126   return __imag__ _Z;
127 }
128
129 __CRT_INLINE double _Complex __MINGW_ATTRIB_CONST conj (double _Complex _Z)
130 {
131   return __extension__ ~_Z;
132 }
133
134 __CRT_INLINE  double __MINGW_ATTRIB_CONST carg (double _Complex _Z)
135 {
136   double res;
137   __asm__  ("fpatan;"
138            : "=t" (res) : "0" (__real__ _Z), "u" (__imag__ _Z) : "st(1)");
139   return res;
140 }
141
142
143 /* float */
144 __CRT_INLINE float __MINGW_ATTRIB_CONST crealf (float _Complex _Z)
145 {
146   return __real__ _Z;
147 }
148
149 __CRT_INLINE float __MINGW_ATTRIB_CONST cimagf (float _Complex _Z)
150 {
151   return __imag__ _Z;
152 }
153
154 __CRT_INLINE float _Complex __MINGW_ATTRIB_CONST conjf (float _Complex _Z)
155 {
156   return __extension__ ~_Z;
157 }
158
159 __CRT_INLINE  float __MINGW_ATTRIB_CONST cargf (float _Complex _Z)
160 {
161   float res;
162   __asm__  ("fpatan;"
163            : "=t" (res) : "0" (__real__ _Z), "u" (__imag__ _Z) : "st(1)");
164   return res;
165 }
166
167 /* long double */
168 __CRT_INLINE long double __MINGW_ATTRIB_CONST creall (long double _Complex _Z)
169 {
170   return __real__ _Z;
171 }
172
173 __CRT_INLINE long double __MINGW_ATTRIB_CONST cimagl (long double _Complex _Z)
174 {
175   return __imag__ _Z;
176 }
177
178 __CRT_INLINE long double _Complex __MINGW_ATTRIB_CONST conjl (long double _Complex _Z)
179 {
180   return __extension__ ~_Z;
181 }
182
183 __CRT_INLINE  long double __MINGW_ATTRIB_CONST cargl (long double _Complex _Z)
184 {
185   long double res;
186   __asm__  ("fpatan;"
187            : "=t" (res) : "0" (__real__ _Z), "u" (__imag__ _Z) : "st(1)");
188   return res;
189 }
190
191 #endif /* RC_INVOKED */
192
193 #ifdef __cplusplus
194 }
195 #endif 
196
197
198 #endif /* _COMPLEX_H */