1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
/*
* Copyright (c) 2002-2013 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* The contents of this file constitute Original Code as defined in and
* are subject to the Apple Public Source License Version 1.1 (the
* "License"). You may not use this file except in compliance with the
* License. Please obtain a copy of the License at
* http://www.apple.com/publicsource and read it before using this file.
*
* This Original Code and all software distributed under the License are
* distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
* License for the specific language governing rights and limitations
* under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/******************************************************************************
* *
* File: complex.h *
* *
* Contains: prototypes and macros germane to C99 complex math. *
* *
******************************************************************************/
#ifndef __COMPLEX_H__
#define __COMPLEX_H__
#include <sys/cdefs.h>
#undef complex
#define complex _Complex
#undef _Complex_I
/* Constant expression of type const float _Complex */
#define _Complex_I (__extension__ 1.0iF)
#undef I
#define I _Complex_I
#if (__STDC_VERSION__ > 199901L || __DARWIN_C_LEVEL >= __DARWIN_C_FULL) \
&& defined __clang__
/* Complex initializer macros. These are a C11 feature, but are also provided
as an extension in C99 so long as strict POSIX conformance is not
requested. They are available only when building with the llvm-clang
compiler, as there is no way to support them with the gcc-4.2 frontend.
These may be used for static initialization of complex values, like so:
static const float complex someVariable = CMPLXF(1.0, INFINITY);
they may, of course, be used outside of static contexts as well. */
#define CMPLX(__real,__imag) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wcomplex-component-init\"") \
(double _Complex){(__real),(__imag)} \
_Pragma("clang diagnostic pop")
#define CMPLXF(__real,__imag) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wcomplex-component-init\"") \
(float _Complex){(__real),(__imag)} \
_Pragma("clang diagnostic pop")
#define CMPLXL(__real,__imag) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wcomplex-component-init\"") \
(long double _Complex){(__real),(__imag)} \
_Pragma("clang diagnostic pop")
#endif /* End C11 features. */
__BEGIN_DECLS
extern float complex cacosf(float complex);
extern double complex cacos(double complex);
extern long double complex cacosl(long double complex);
extern float complex casinf(float complex);
extern double complex casin(double complex);
extern long double complex casinl(long double complex);
extern float complex catanf(float complex);
extern double complex catan(double complex);
extern long double complex catanl(long double complex);
extern float complex ccosf(float complex);
extern double complex ccos(double complex);
extern long double complex ccosl(long double complex);
extern float complex csinf(float complex);
extern double complex csin(double complex);
extern long double complex csinl(long double complex);
extern float complex ctanf(float complex);
extern double complex ctan(double complex);
extern long double complex ctanl(long double complex);
extern float complex cacoshf(float complex);
extern double complex cacosh(double complex);
extern long double complex cacoshl(long double complex);
extern float complex casinhf(float complex);
extern double complex casinh(double complex);
extern long double complex casinhl(long double complex);
extern float complex catanhf(float complex);
extern double complex catanh(double complex);
extern long double complex catanhl(long double complex);
extern float complex ccoshf(float complex);
extern double complex ccosh(double complex);
extern long double complex ccoshl(long double complex);
extern float complex csinhf(float complex);
extern double complex csinh(double complex);
extern long double complex csinhl(long double complex);
extern float complex ctanhf(float complex);
extern double complex ctanh(double complex);
extern long double complex ctanhl(long double complex);
extern float complex cexpf(float complex);
extern double complex cexp(double complex);
extern long double complex cexpl(long double complex);
extern float complex clogf(float complex);
extern double complex clog(double complex);
extern long double complex clogl(long double complex);
extern float cabsf(float complex);
extern double cabs(double complex);
extern long double cabsl(long double complex);
extern float complex cpowf(float complex, float complex);
extern double complex cpow(double complex, double complex);
extern long double complex cpowl(long double complex, long double complex);
extern float complex csqrtf(float complex);
extern double complex csqrt(double complex);
extern long double complex csqrtl(long double complex);
extern float cargf(float complex);
extern double carg(double complex);
extern long double cargl(long double complex);
extern float cimagf(float complex);
extern double cimag(double complex);
extern long double cimagl(long double complex);
extern float complex conjf(float complex);
extern double complex conj(double complex);
extern long double complex conjl(long double complex);
extern float complex cprojf(float complex);
extern double complex cproj(double complex);
extern long double complex cprojl(long double complex);
extern float crealf(float complex);
extern double creal(double complex);
extern long double creall(long double complex);
__END_DECLS
#endif /* __COMPLEX_H__ */
|