• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*-
2  * Copyright (c) 2001-2011 The FreeBSD Project.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28 
29 #ifndef _COMPLEX_H
30 #define	_COMPLEX_H
31 
32 #include <sys/cdefs.h>
33 
34 #ifdef __GNUC__
35 #define	_Complex_I	((float _Complex)1.0i)
36 #endif
37 
38 #ifdef __generic
39 _Static_assert(__generic(_Complex_I, float _Complex, 1, 0),
40     "_Complex_I must be of type float _Complex");
41 #endif
42 
43 #define	complex		_Complex
44 #define	I		_Complex_I
45 
46 #if __STDC_VERSION__ >= 201112L
47 #define	CMPLX(x, y)	((double complex){ x, y })
48 #define	CMPLXF(x, y)	((float complex){ x, y })
49 #define	CMPLXL(x, y)	((long double complex){ x, y })
50 #endif
51 
52 __BEGIN_DECLS
53 
54 /* 7.3.5 Trigonometric functions */
55 /* 7.3.5.1 The cacos functions */
56 double complex cacos(double complex __z) __INTRODUCED_IN(23);
57 float complex cacosf(float complex __z) __INTRODUCED_IN(23);
58 long double complex cacosl(long double complex __z) __RENAME_LDBL(cacos, 23, 26);
59 /* 7.3.5.2 The casin functions */
60 double complex casin(double complex __z) __INTRODUCED_IN(23);
61 float complex casinf(float complex __z) __INTRODUCED_IN(23);
62 long double complex casinl(long double complex __z) __RENAME_LDBL(casin, 23, 26);
63 /* 7.3.5.1 The catan functions */
64 double complex catan(double complex __z) __INTRODUCED_IN(23);
65 float complex catanf(float complex __z) __INTRODUCED_IN(23);
66 long double complex catanl(long double complex __z) __RENAME_LDBL(catan, 23, 26);
67 /* 7.3.5.1 The ccos functions */
68 double complex ccos(double complex __z) __INTRODUCED_IN(23);
69 float complex ccosf(float complex __z) __INTRODUCED_IN(23);
70 long double complex ccosl(long double complex __z) __RENAME_LDBL(ccos, 23, 26);
71 /* 7.3.5.1 The csin functions */
72 double complex csin(double complex __z) __INTRODUCED_IN(23);
73 float complex csinf(float complex __z) __INTRODUCED_IN(23);
74 long double complex csinl(long double complex __z) __RENAME_LDBL(csin, 23, 26);
75 /* 7.3.5.1 The ctan functions */
76 double complex ctan(double complex __z) __INTRODUCED_IN(23);
77 float complex ctanf(float complex __z) __INTRODUCED_IN(23);
78 long double complex ctanl(long double complex __z) __RENAME_LDBL(ctan, 23, 26);
79 
80 /* 7.3.6 Hyperbolic functions */
81 /* 7.3.6.1 The cacosh functions */
82 double complex cacosh(double complex __z) __INTRODUCED_IN(23);
83 float complex cacoshf(float complex __z) __INTRODUCED_IN(23);
84 long double complex cacoshl(long double complex __z) __RENAME_LDBL(cacosh, 23, 26);
85 /* 7.3.6.2 The casinh functions */
86 double complex casinh(double complex __z) __INTRODUCED_IN(23);
87 float complex casinhf(float complex __z) __INTRODUCED_IN(23);
88 long double complex casinhl(long double complex __z) __RENAME_LDBL(casinh, 23, 26);
89 /* 7.3.6.3 The catanh functions */
90 double complex catanh(double complex __z) __INTRODUCED_IN(23);
91 float complex catanhf(float complex __z) __INTRODUCED_IN(23);
92 long double complex catanhl(long double complex __z) __RENAME_LDBL(catanh, 23, 26);
93 /* 7.3.6.4 The ccosh functions */
94 double complex ccosh(double complex __z) __INTRODUCED_IN(23);
95 float complex ccoshf(float complex __z) __INTRODUCED_IN(23);
96 long double complex ccoshl(long double complex __z) __RENAME_LDBL(ccosh, 23, 26);
97 /* 7.3.6.5 The csinh functions */
98 double complex csinh(double complex __z) __INTRODUCED_IN(23);
99 float complex csinhf(float complex __z) __INTRODUCED_IN(23);
100 long double complex csinhl(long double complex __z) __RENAME_LDBL(csinh, 23, 26);
101 /* 7.3.6.6 The ctanh functions */
102 double complex ctanh(double complex __z) __INTRODUCED_IN(23);
103 float complex ctanhf(float complex __z) __INTRODUCED_IN(23);
104 long double complex ctanhl(long double complex __z) __RENAME_LDBL(ctanh, 23, 26);
105 
106 /* 7.3.7 Exponential and logarithmic functions */
107 /* 7.3.7.1 The cexp functions */
108 double complex cexp(double complex __z) __INTRODUCED_IN(23);
109 float complex cexpf(float complex __z) __INTRODUCED_IN(23);
110 long double complex cexpl(long double complex __z) __RENAME_LDBL(cexp, 23, 26);
111 /* 7.3.7.2 The clog functions */
112 double complex clog(double complex __z) __INTRODUCED_IN(26);
113 float complex clogf(float complex __z) __INTRODUCED_IN(26);
114 long double complex clogl(long double complex __z) __RENAME_LDBL(clog, 26, 26);
115 
116 /* 7.3.8 Power and absolute-value functions */
117 /* 7.3.8.1 The cabs functions */
118 double cabs(double complex __z) __INTRODUCED_IN(23);
119 float cabsf(float complex __z) __INTRODUCED_IN(23);
120 long double cabsl(long double complex __z) __INTRODUCED_IN_32(21) __INTRODUCED_IN_64(23) /*__RENAME_LDBL(cabs)*/;
121 /* 7.3.8.2 The cpow functions */
122 double complex cpow(double complex __x, double complex __z) __INTRODUCED_IN(26);
123 float complex cpowf(float complex __x, float complex __z) __INTRODUCED_IN(26);
124 long double complex cpowl(long double complex __x, long double complex __z) __RENAME_LDBL(cpow, 26, 26);
125 /* 7.3.8.3 The csqrt functions */
126 double complex csqrt(double complex __z) __INTRODUCED_IN(23);
127 float complex csqrtf(float complex __z) __INTRODUCED_IN(23);
128 long double complex csqrtl(long double complex __z) __INTRODUCED_IN_32(21) __INTRODUCED_IN_64(23) /*__RENAME_LDBL(csqrt)*/;
129 
130 /* 7.3.9 Manipulation functions */
131 /* 7.3.9.1 The carg functions */
132 double carg(double complex __z) __INTRODUCED_IN(23);
133 float cargf(float complex __z) __INTRODUCED_IN(23);
134 long double cargl(long double complex __z) __RENAME_LDBL(carg, 23, 23);
135 /* 7.3.9.2 The cimag functions */
136 double cimag(double complex __z) __INTRODUCED_IN(23);
137 float cimagf(float complex __z) __INTRODUCED_IN(23);
138 long double cimagl(long double complex __z) __RENAME_LDBL(cimag, 23, 23);
139 /* 7.3.9.3 The conj functions */
140 double complex conj(double complex __z) __INTRODUCED_IN(23);
141 float complex conjf(float complex __z) __INTRODUCED_IN(23);
142 long double complex conjl(long double complex __z) __RENAME_LDBL(conj, 23, 23);
143 /* 7.3.9.4 The cproj functions */
144 double complex cproj(double complex __z) __INTRODUCED_IN(23);
145 float complex cprojf(float complex __z) __INTRODUCED_IN(23);
146 long double complex cprojl(long double complex __z) __INTRODUCED_IN_32(21) __INTRODUCED_IN_64(23) /*__RENAME_LDBL(cproj)*/;
147 /* 7.3.9.5 The creal functions */
148 double creal(double complex __z) __INTRODUCED_IN(23);
149 float crealf(float complex __z) __INTRODUCED_IN(23);
150 long double creall(long double complex __z) __RENAME_LDBL(creal, 23, 23);
151 
152 __END_DECLS
153 
154 #endif
155