source: Daodan/MinGW/include/complex.h@ 1047

Last change on this file since 1047 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

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