blob: dfd7604b233d858b1d3f1f4c575cde9c4e29d318 [file] [log] [blame]
Elliott Hughes13da6002025-02-03 10:42:13 -08001// Copyright (C) 2017 The Android Open Source Project
2// SPDX-License-Identifier: BSD-2-Clause
Elliott Hughes21b56eb2017-10-20 17:57:17 -07003
4#include <math.h>
5
6#include "header_checks.h"
7
8static void math_h() {
9 TYPE(float_t);
10 TYPE(double_t);
11
12#if !defined(fpclassify)
13#error fpclassify
14#endif
15#if !defined(isfinite)
16#error isfinite
17#endif
18#if !defined(isgreater)
19#error isgreater
20#endif
21#if !defined(isgreaterequal)
22#error isgreaterequal
23#endif
24#if !defined(isinf)
25#error isinf
26#endif
27#if !defined(isless)
28#error isless
29#endif
30#if !defined(islessequal)
31#error islessequal
32#endif
33#if !defined(islessgreater)
34#error islessgreater
35#endif
36#if !defined(isnan)
37#error isnan
38#endif
39#if !defined(isnormal)
40#error isnormal
41#endif
42#if !defined(isunordered)
43#error isunordered
44#endif
45#if !defined(signbit)
46#error signbit
47#endif
48
49 MACRO(M_E);
50 MACRO(M_LOG2E);
51 MACRO(M_LOG10E);
52 MACRO(M_LN2);
53 MACRO(M_LN10);
54 MACRO(M_PI);
55 MACRO(M_PI_2);
56 MACRO(M_PI_4);
57 MACRO(M_1_PI);
58 MACRO(M_2_PI);
59 MACRO(M_2_SQRTPI);
60 MACRO(M_SQRT2);
61 MACRO(M_SQRT1_2);
62
63 MACRO(MAXFLOAT);
64
65 MACRO(HUGE_VAL);
66 MACRO(HUGE_VALF);
67 MACRO(HUGE_VALL);
68 MACRO(INFINITY);
69 MACRO(NAN);
70
71 MACRO(FP_INFINITE);
72 MACRO(FP_NAN);
73 MACRO(FP_NORMAL);
74 MACRO(FP_SUBNORMAL);
75 MACRO(FP_ZERO);
76
77#if defined(FP_FAST_FMA) && FP_FAST_FMA != 1
78#error FP_FAST_FMA
79#endif
80#if defined(FP_FAST_FMAF) && FP_FAST_FMAF != 1
81#error FP_FAST_FMAF
82#endif
83#if defined(FP_FAST_FMAL) && FP_FAST_FMAL != 1
84#error FP_FAST_FMAL
85#endif
86
87 MACRO(FP_ILOGB0);
88 MACRO(FP_ILOGBNAN);
89
90 MACRO_VALUE(MATH_ERRNO, 1);
91 MACRO_VALUE(MATH_ERREXCEPT, 2);
92
93#if !defined(math_errhandling)
94#error math_errhandling
95#endif
96 MACRO_TYPE(int, math_errhandling);
97
98 FUNCTION(acos, double (*f)(double));
99 FUNCTION(acosf, float (*f)(float));
100 FUNCTION(acosh, double (*f)(double));
101 FUNCTION(acoshf, float (*f)(float));
102 FUNCTION(acoshl, long double (*f)(long double));
103 FUNCTION(acosl, long double (*f)(long double));
104
105 FUNCTION(asin, double (*f)(double));
106 FUNCTION(asinf, float (*f)(float));
107 FUNCTION(asinh, double (*f)(double));
108 FUNCTION(asinhf, float (*f)(float));
109 FUNCTION(asinhl, long double (*f)(long double));
110 FUNCTION(asinl, long double (*f)(long double));
111
112 FUNCTION(atan, double (*f)(double));
113 FUNCTION(atan2, double (*f)(double, double));
114 FUNCTION(atan2f, float (*f)(float, float));
115 FUNCTION(atan2l, long double (*f)(long double, long double));
116 FUNCTION(atanf, float (*f)(float));
117 FUNCTION(atanh, double (*f)(double));
118 FUNCTION(atanhf, float (*f)(float));
119 FUNCTION(atanhl, long double (*f)(long double));
120 FUNCTION(atanl, long double (*f)(long double));
121
122 FUNCTION(cbrt, double (*f)(double));
123 FUNCTION(cbrtf, float (*f)(float));
124 FUNCTION(cbrtl, long double (*f)(long double));
125
126 FUNCTION(ceil, double (*f)(double));
127 FUNCTION(ceilf, float (*f)(float));
128 FUNCTION(ceill, long double (*f)(long double));
129
130 FUNCTION(copysign, double (*f)(double, double));
131 FUNCTION(copysignf, float (*f)(float, float));
132 FUNCTION(copysignl, long double (*f)(long double, long double));
133
134 FUNCTION(cos, double (*f)(double));
135 FUNCTION(cosf, float (*f)(float));
136 FUNCTION(cosh, double (*f)(double));
137 FUNCTION(coshf, float (*f)(float));
138 FUNCTION(coshl, long double (*f)(long double));
139 FUNCTION(cosl, long double (*f)(long double));
140
141 FUNCTION(erf, double (*f)(double));
142 FUNCTION(erfc, double (*f)(double));
143 FUNCTION(erfcf, float (*f)(float));
144 FUNCTION(erfcl, long double (*f)(long double));
145 FUNCTION(erff, float (*f)(float));
146 FUNCTION(erfl, long double (*f)(long double));
147
148 FUNCTION(exp, double (*f)(double));
149 FUNCTION(exp2, double (*f)(double));
150 FUNCTION(exp2f, float (*f)(float));
151 FUNCTION(exp2l, long double (*f)(long double));
152 FUNCTION(expf, float (*f)(float));
153 FUNCTION(expl, long double (*f)(long double));
154 FUNCTION(expm1, double (*f)(double));
155 FUNCTION(expm1f, float (*f)(float));
156 FUNCTION(expm1l, long double (*f)(long double));
157
158 FUNCTION(fabs, double (*f)(double));
159 FUNCTION(fabsf, float (*f)(float));
160 FUNCTION(fabsl, long double (*f)(long double));
161
162 FUNCTION(fdim, double (*f)(double, double));
163 FUNCTION(fdimf, float (*f)(float, float));
164 FUNCTION(fdiml, long double (*f)(long double, long double));
165
166 FUNCTION(floor, double (*f)(double));
167 FUNCTION(floorf, float (*f)(float));
168 FUNCTION(floorl, long double (*f)(long double));
169
170 FUNCTION(fma, double (*f)(double, double, double));
171 FUNCTION(fmaf, float (*f)(float, float, float));
172 FUNCTION(fmal, long double (*f)(long double, long double, long double));
173
174 FUNCTION(fmax, double (*f)(double, double));
175 FUNCTION(fmaxf, float (*f)(float, float));
176 FUNCTION(fmaxl, long double (*f)(long double, long double));
177
178 FUNCTION(fmin, double (*f)(double, double));
179 FUNCTION(fminf, float (*f)(float, float));
180 FUNCTION(fminl, long double (*f)(long double, long double));
181
182 FUNCTION(fmod, double (*f)(double, double));
183 FUNCTION(fmodf, float (*f)(float, float));
184 FUNCTION(fmodl, long double (*f)(long double, long double));
185
186 FUNCTION(frexp, double (*f)(double, int*));
187 FUNCTION(frexpf, float (*f)(float, int*));
188 FUNCTION(frexpl, long double (*f)(long double, int*));
189
190 FUNCTION(hypot, double (*f)(double, double));
191 FUNCTION(hypotf, float (*f)(float, float));
192 FUNCTION(hypotl, long double (*f)(long double, long double));
193
194 FUNCTION(ilogb, int (*f)(double));
195 FUNCTION(ilogbf, int (*f)(float));
196 FUNCTION(ilogbl, int (*f)(long double));
197
198 FUNCTION(j0, double (*f)(double));
199 FUNCTION(j1, double (*f)(double));
200 FUNCTION(jn, double (*f)(int, double));
201
202 FUNCTION(ldexp, double (*f)(double, int));
203 FUNCTION(ldexpf, float (*f)(float, int));
204 FUNCTION(ldexpl, long double (*f)(long double, int));
205
206 FUNCTION(lgamma, double (*f)(double));
207 FUNCTION(lgammaf, float (*f)(float));
208 FUNCTION(lgammal, long double (*f)(long double));
209
210 FUNCTION(llrint, long long (*f)(double));
211 FUNCTION(llrintf, long long (*f)(float));
212 FUNCTION(llrintl, long long (*f)(long double));
213
214 FUNCTION(llround, long long (*f)(double));
215 FUNCTION(llroundf, long long (*f)(float));
216 FUNCTION(llroundl, long long (*f)(long double));
217
218 FUNCTION(log, double (*f)(double));
219 FUNCTION(log10, double (*f)(double));
220 FUNCTION(log10f, float (*f)(float));
221 FUNCTION(log10l, long double (*f)(long double));
222 FUNCTION(log1p, double (*f)(double));
223 FUNCTION(log1pf, float (*f)(float));
224 FUNCTION(log1pl, long double (*f)(long double));
225 FUNCTION(log2, double (*f)(double));
226 FUNCTION(log2f, float (*f)(float));
227 FUNCTION(log2l, long double (*f)(long double));
228 FUNCTION(logb, double (*f)(double));
229 FUNCTION(logbf, float (*f)(float));
230 FUNCTION(logbl, long double (*f)(long double));
231 FUNCTION(logf, float (*f)(float));
232 FUNCTION(logl, long double (*f)(long double));
233
234 FUNCTION(lrint, long (*f)(double));
235 FUNCTION(lrintf, long (*f)(float));
236 FUNCTION(lrintl, long (*f)(long double));
237
238 FUNCTION(lround, long (*f)(double));
239 FUNCTION(lroundf, long (*f)(float));
240 FUNCTION(lroundl, long (*f)(long double));
241
242 FUNCTION(modf, double (*f)(double, double*));
243 FUNCTION(modff, float (*f)(float, float*));
244 FUNCTION(modfl, long double (*f)(long double, long double*));
245
246 FUNCTION(nan, double (*f)(const char*));
247 FUNCTION(nanf, float (*f)(const char*));
248 FUNCTION(nanl, long double (*f)(const char*));
249
250 FUNCTION(nearbyint, double (*f)(double));
251 FUNCTION(nearbyintf, float (*f)(float));
252 FUNCTION(nearbyintl, long double (*f)(long double));
253
254 FUNCTION(nextafter, double (*f)(double, double));
255 FUNCTION(nextafterf, float (*f)(float, float));
256 FUNCTION(nextafterl, long double (*f)(long double, long double));
257
258 FUNCTION(nexttoward, double (*f)(double, long double));
259 FUNCTION(nexttowardf, float (*f)(float, long double));
260 FUNCTION(nexttowardl, long double (*f)(long double, long double));
261
262 FUNCTION(pow, double (*f)(double, double));
263 FUNCTION(powf, float (*f)(float, float));
264 FUNCTION(powl, long double (*f)(long double, long double));
265
266 FUNCTION(remainder, double (*f)(double, double));
267 FUNCTION(remainderf, float (*f)(float, float));
268 FUNCTION(remainderl, long double (*f)(long double, long double));
269
270 FUNCTION(remquo, double (*f)(double, double, int*));
271 FUNCTION(remquof, float (*f)(float, float, int*));
272 FUNCTION(remquol, long double (*f)(long double, long double, int*));
273
274 FUNCTION(rint, double (*f)(double));
275 FUNCTION(rintf, float (*f)(float));
276 FUNCTION(rintl, long double (*f)(long double));
277
278 FUNCTION(round, double (*f)(double));
279 FUNCTION(roundf, float (*f)(float));
280 FUNCTION(roundl, long double (*f)(long double));
281
282 FUNCTION(scalbln, double (*f)(double, long));
283 FUNCTION(scalblnf, float (*f)(float, long));
284 FUNCTION(scalblnl, long double (*f)(long double, long));
285
286 FUNCTION(scalbn, double (*f)(double, int));
287 FUNCTION(scalbnf, float (*f)(float, int));
288 FUNCTION(scalbnl, long double (*f)(long double, int));
289
290 FUNCTION(sin, double (*f)(double));
291 FUNCTION(sinf, float (*f)(float));
292 FUNCTION(sinh, double (*f)(double));
293 FUNCTION(sinhf, float (*f)(float));
294 FUNCTION(sinhl, long double (*f)(long double));
295 FUNCTION(sinl, long double (*f)(long double));
296
297 FUNCTION(sqrt, double (*f)(double));
298 FUNCTION(sqrtf, float (*f)(float));
299 FUNCTION(sqrtl, long double (*f)(long double));
300
301 FUNCTION(tan, double (*f)(double));
302 FUNCTION(tanf, float (*f)(float));
303 FUNCTION(tanh, double (*f)(double));
304 FUNCTION(tanhf, float (*f)(float));
305 FUNCTION(tanhl, long double (*f)(long double));
306 FUNCTION(tanl, long double (*f)(long double));
307
308 FUNCTION(tgamma, double (*f)(double));
309 FUNCTION(tgammaf, float (*f)(float));
310 FUNCTION(tgammal, long double (*f)(long double));
311
312 FUNCTION(trunc, double (*f)(double));
313 FUNCTION(truncf, float (*f)(float));
314 FUNCTION(truncl, long double (*f)(long double));
315
316 FUNCTION(y0, double (*f)(double));
317 FUNCTION(y1, double (*f)(double));
318 FUNCTION(yn, double (*f)(int, double));
319
320 int s = signgam;
321}