1 /*
2 * Copyright (C) 2017 The Android Open Source 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 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29 #include <tgmath.h>
30
31 #include "header_checks.h"
32
33 #define TGMATH(f_) f_(f1); f_(d1); f_(ld1);
34 #define TGMATHC(f_) f_(f1); f_(d1); f_(ld1); f_(fc1); f_(dc1); f_(ldc1);
35 #define TGMATHCONLY(f_) f_(fc1); f_(dc1); f_(ldc1);
36 #define TGMATH2(f_) f_(f1, f2); f_(d1, d2); f_(ld1, ld2);
37 #define TGMATH2C(f_) f_(f1, f2); f_(d1, d2); f_(ld1, ld2); f_(fc1, fc2); f_(dc1, dc2); f_(ldc1, ldc2);
38 #define TGMATH3(f_) f_(f1, f2, f3); f_(d1, d2, d3); f_(ld1, ld2, ld3);
39
tgmath_h()40 static void tgmath_h() {
41 float f1, f2, f3;
42 f1 = f2 = f3 = 0;
43 float complex fc1, fc2, fc3;
44 fc1 = fc2 = fc3 = 0;
45 double d1, d2, d3;
46 d1 = d2 = d3 = 0;
47 double complex dc1, dc2, dc3;
48 dc1 = dc2 = dc3 = 0;
49 long double ld1, ld2, ld3;
50 ld1 = ld2 = ld3 = 0;
51 long double complex ldc1, ldc2, ldc3;
52 ldc1 = ldc2 = ldc3 = 0;
53 int i = 0;
54 long l = 0;
55
56 TGMATHC(acos);
57 TGMATHC(asin);
58 TGMATHC(atan);
59 TGMATHC(acosh);
60 TGMATHC(asinh);
61 TGMATHC(atanh);
62 TGMATHC(cos);
63 TGMATHC(sin);
64 TGMATHC(tan);
65 TGMATHC(cosh);
66 TGMATHC(sinh);
67 TGMATHC(tanh);
68 TGMATHC(exp);
69 TGMATHC(log);
70 TGMATH2C(pow);
71 TGMATHC(sqrt);
72 TGMATHC(fabs);
73
74 TGMATH2(atan2);
75 TGMATH(cbrt);
76 TGMATH(ceil);
77 TGMATH2(copysign);
78 TGMATH(erf);
79 TGMATH(erfc);
80 TGMATH(exp2);
81 TGMATH(expm1);
82 TGMATH2(fdim);
83 TGMATH(floor);
84 TGMATH3(fma);
85 TGMATH2(fmax);
86 TGMATH2(fmin);
87 TGMATH2(fmod);
88 frexp(f1, &i); frexp(d1, &i); frexp(ld1, &i);
89 TGMATH2(hypot);
90 TGMATH(ilogb);
91 ldexp(f1, i); ldexp(d1, i); ldexp(ld1, i);
92 TGMATH(lgamma);
93 TGMATH(llrint);
94 TGMATH(llround);
95 TGMATH(log10);
96 TGMATH(log1p);
97 TGMATH(log2);
98 TGMATH(logb);
99 TGMATH(lrint);
100 TGMATH(lround);
101 TGMATH(nearbyint);
102 TGMATH2(nextafter);
103 TGMATH2(nexttoward);
104 TGMATH2(remainder);
105 remquo(f1, f2, &i); remquo(d1, d2, &i); remquo(ld1, ld2, &i);
106 TGMATH(rint);
107 TGMATH(round);
108 scalbln(f1, l); scalbln(d1, l); scalbln(ld1, l);
109 scalbn(f1, i); scalbn(d1, i); scalbn(ld1, i);
110 TGMATH(tgamma);
111 TGMATH(trunc);
112
113 TGMATHCONLY(carg);
114 TGMATHCONLY(cimag);
115 TGMATHCONLY(conj);
116 TGMATHCONLY(cproj);
117 TGMATHCONLY(creal);
118 }
119