05462020e5afbaf305ddbd0d31f51a93f1f9cf28
[libc-test] / src / math / gen / mplibm.c
1 #include "gen.h"
2
3 #include <stdio.h>
4 static int mpf1(struct t *s, float (*f)(float))
5 {
6         s->dy = 0;
7         setupfenv(s->r);
8         s->y = f(s->x);
9         s->e = getexcept();
10         return 0;
11 }
12
13 static int mpf2(struct t *s, float (*f)(float,float))
14 {
15         s->dy = 0;
16         setupfenv(s->r);
17         s->y = f(s->x, s->x2);
18         s->e = getexcept();
19         return 0;
20 }
21
22 static int mpd1(struct t *s, double (*f)(double))
23 {
24         s->dy = 0;
25         setupfenv(s->r);
26         s->y = f(s->x);
27         s->e = getexcept();
28 //printf("%La %d\n", s->y, s->e);
29         return 0;
30 }
31
32 static int mpd2(struct t *s, double (*f)(double, double))
33 {
34         s->dy = 0;
35         setupfenv(s->r);
36         s->y = f(s->x, s->x2);
37         s->e = getexcept();
38         return 0;
39 }
40
41 static int mpl1(struct t *s, long double (*f)(long double))
42 {
43         s->dy = 0;
44         setupfenv(s->r);
45         s->y = f(s->x);
46         s->e = getexcept();
47         return 0;
48 }
49
50 static int mpl2(struct t *s, long double (*f)(long double, long double))
51 {
52         setupfenv(s->r);
53         s->y = f(s->x, s->x2);
54         s->dy = 0;
55         s->e = getexcept();
56         return 0;
57 }
58
59
60 int mpacos(struct t *t) { return mpd1(t, acos); }
61 int mpacosf(struct t *t) { return mpf1(t, acosf); }
62 int mpacosl(struct t *t) { return mpl1(t, acosl); }
63 int mpacosh(struct t *t) { return mpd1(t, acosh); }
64 int mpacoshf(struct t *t) { return mpf1(t, acoshf); }
65 int mpacoshl(struct t *t) { return mpl1(t, acoshl); }
66 int mpasin(struct t *t) { return mpd1(t, asin); }
67 int mpasinf(struct t *t) { return mpf1(t, asinf); }
68 int mpasinl(struct t *t) { return mpl1(t, asinl); }
69 int mpasinh(struct t *t) { return mpd1(t, asinh); }
70 int mpasinhf(struct t *t) { return mpf1(t, asinhf); }
71 int mpasinhl(struct t *t) { return mpl1(t, asinhl); }
72 int mpatan(struct t *t) { return mpd1(t, atan); }
73 int mpatanf(struct t *t) { return mpf1(t, atanf); }
74 int mpatanl(struct t *t) { return mpl1(t, atanl); }
75 int mpatan2(struct t *t) { return mpd2(t, atan2); }
76 int mpatan2f(struct t *t) { return mpf2(t, atan2f); }
77 int mpatan2l(struct t *t) { return mpl2(t, atan2l); }
78 int mpatanh(struct t *t) { return mpd1(t, atanh); }
79 int mpatanhf(struct t *t) { return mpf1(t, atanhf); }
80 int mpatanhl(struct t *t) { return mpl1(t, atanhl); }
81 int mpcbrt(struct t *t) { return mpd1(t, cbrt); }
82 int mpcbrtf(struct t *t) { return mpf1(t, cbrtf); }
83 int mpcbrtl(struct t *t) { return mpl1(t, cbrtl); }
84 int mpceil(struct t *t) { return mpd1(t, ceil); }
85 int mpceilf(struct t *t) { return mpf1(t, ceilf); }
86 int mpceill(struct t *t) { return mpl1(t, ceill); }
87 int mpcopysign(struct t *t) { return mpd2(t, copysign); }
88 int mpcopysignf(struct t *t) { return mpf2(t, copysignf); }
89 int mpcopysignl(struct t *t) { return mpl2(t, copysignl); }
90 int mpcos(struct t *t) { return mpd1(t, cos); }
91 int mpcosf(struct t *t) { return mpf1(t, cosf); }
92 int mpcosl(struct t *t) { return mpl1(t, cosl); }
93 int mpcosh(struct t *t) { return mpd1(t, cosh); }
94 int mpcoshf(struct t *t) { return mpf1(t, coshf); }
95 int mpcoshl(struct t *t) { return mpl1(t, coshl); }
96 int mperf(struct t *t) { return mpd1(t, erf); }
97 int mperff(struct t *t) { return mpf1(t, erff); }
98 int mperfl(struct t *t) { return mpl1(t, erfl); }
99 int mperfc(struct t *t) { return mpd1(t, erfc); }
100 int mperfcf(struct t *t) { return mpf1(t, erfcf); }
101 int mperfcl(struct t *t) { return mpl1(t, erfcl); }
102 int mpexp(struct t *t) { return mpd1(t, exp); }
103 int mpexpf(struct t *t) { return mpf1(t, expf); }
104 int mpexpl(struct t *t) { return mpl1(t, expl); }
105 int mpexp2(struct t *t) { return mpd1(t, exp2); }
106 int mpexp2f(struct t *t) { return mpf1(t, exp2f); }
107 int mpexp2l(struct t *t) { return mpl1(t, exp2l); }
108 int mpexpm1(struct t *t) { return mpd1(t, expm1); }
109 int mpexpm1f(struct t *t) { return mpf1(t, expm1f); }
110 int mpexpm1l(struct t *t) { return mpl1(t, expm1l); }
111 int mpfabs(struct t *t) { return mpd1(t, fabs); }
112 int mpfabsf(struct t *t) { return mpf1(t, fabsf); }
113 int mpfabsl(struct t *t) { return mpl1(t, fabsl); }
114 int mpfdim(struct t *t) { return mpd2(t, fdim); }
115 int mpfdimf(struct t *t) { return mpf2(t, fdimf); }
116 int mpfdiml(struct t *t) { return mpl2(t, fdiml); }
117 int mpfloor(struct t *t) { return mpd1(t, floor); }
118 int mpfloorf(struct t *t) { return mpf1(t, floorf); }
119 int mpfloorl(struct t *t) { return mpl1(t, floorl); }
120 int mpfmax(struct t *t) { return mpd2(t, fmax); }
121 int mpfmaxf(struct t *t) { return mpf2(t, fmaxf); }
122 int mpfmaxl(struct t *t) { return mpl2(t, fmaxl); }
123 int mpfmin(struct t *t) { return mpd2(t, fmin); }
124 int mpfminf(struct t *t) { return mpf2(t, fminf); }
125 int mpfminl(struct t *t) { return mpl2(t, fminl); }
126 int mpfmod(struct t *t) { return mpd2(t, fmod); }
127 int mpfmodf(struct t *t) { return mpf2(t, fmodf); }
128 int mpfmodl(struct t *t) { return mpl2(t, fmodl); }
129 int mphypot(struct t *t) { return mpd2(t, hypot); }
130 int mphypotf(struct t *t) { return mpf2(t, hypotf); }
131 int mphypotl(struct t *t) { return mpl2(t, hypotl); }
132 int mplog(struct t *t) { return mpd1(t, log); }
133 int mplogf(struct t *t) { return mpf1(t, logf); }
134 int mplogl(struct t *t) { return mpl1(t, logl); }
135 int mplog10(struct t *t) { return mpd1(t, log10); }
136 int mplog10f(struct t *t) { return mpf1(t, log10f); }
137 int mplog10l(struct t *t) { return mpl1(t, log10l); }
138 int mplog1p(struct t *t) { return mpd1(t, log1p); }
139 int mplog1pf(struct t *t) { return mpf1(t, log1pf); }
140 int mplog1pl(struct t *t) { return mpl1(t, log1pl); }
141 int mplog2(struct t *t) { return mpd1(t, log2); }
142 int mplog2f(struct t *t) { return mpf1(t, log2f); }
143 int mplog2l(struct t *t) { return mpl1(t, log2l); }
144 int mplogb(struct t *t) { return mpd1(t, logb); }
145 int mplogbf(struct t *t) { return mpf1(t, logbf); }
146 int mplogbl(struct t *t) { return mpl1(t, logbl); }
147 int mpnearbyint(struct t *t) { return mpd1(t, nearbyint); }
148 int mpnearbyintf(struct t *t) { return mpf1(t, nearbyintf); }
149 int mpnearbyintl(struct t *t) { return mpl1(t, nearbyintl); }
150 int mpnextafter(struct t *t) { return mpd2(t, nextafter); }
151 int mpnextafterf(struct t *t) { return mpf2(t, nextafterf); }
152 int mpnextafterl(struct t *t) { return mpl2(t, nextafterl); }
153 int mpnexttowardl(struct t *t) { return mpl2(t, nexttowardl); }
154 int mppow(struct t *t) { return mpd2(t, pow); }
155 int mppowf(struct t *t) { return mpf2(t, powf); }
156 int mppowl(struct t *t) { return mpl2(t, powl); }
157 int mpremainder(struct t *t) { return mpd2(t, remainder); }
158 int mpremainderf(struct t *t) { return mpf2(t, remainderf); }
159 int mpremainderl(struct t *t) { return mpl2(t, remainderl); }
160 int mprint(struct t *t) { return mpd1(t, rint); }
161 int mprintf(struct t *t) { return mpf1(t, rintf); }
162 int mprintl(struct t *t) { return mpl1(t, rintl); }
163 int mpround(struct t *t) { return mpd1(t, round); }
164 int mproundf(struct t *t) { return mpf1(t, roundf); }
165 int mproundl(struct t *t) { return mpl1(t, roundl); }
166 int mpsin(struct t *t) { return mpd1(t, sin); }
167 int mpsinf(struct t *t) { return mpf1(t, sinf); }
168 int mpsinl(struct t *t) { return mpl1(t, sinl); }
169 int mpsinh(struct t *t) { return mpd1(t, sinh); }
170 int mpsinhf(struct t *t) { return mpf1(t, sinhf); }
171 int mpsinhl(struct t *t) { return mpl1(t, sinhl); }
172 int mpsqrt(struct t *t) { return mpd1(t, sqrt); }
173 int mpsqrtf(struct t *t) { return mpf1(t, sqrtf); }
174 int mpsqrtl(struct t *t) { return mpl1(t, sqrtl); }
175 int mptan(struct t *t) { return mpd1(t, tan); }
176 int mptanf(struct t *t) { return mpf1(t, tanf); }
177 int mptanl(struct t *t) { return mpl1(t, tanl); }
178 int mptanh(struct t *t) { return mpd1(t, tanh); }
179 int mptanhf(struct t *t) { return mpf1(t, tanhf); }
180 int mptanhl(struct t *t) { return mpl1(t, tanhl); }
181 int mptgamma(struct t *t) { return mpd1(t, tgamma); }
182 int mptgammaf(struct t *t) { return mpf1(t, tgammaf); }
183 int mptgammal(struct t *t) { return mpl1(t, tgammal); }
184 int mptrunc(struct t *t) { return mpd1(t, trunc); }
185 int mptruncf(struct t *t) { return mpf1(t, truncf); }
186 int mptruncl(struct t *t) { return mpl1(t, truncl); }
187 int mpj0(struct t *t) { return mpd1(t, j0); }
188 int mpj1(struct t *t) { return mpd1(t, j1); }
189 int mpy0(struct t *t) { return mpd1(t, y0); }
190 int mpy1(struct t *t) { return mpd1(t, y1); }
191 int mpscalb(struct t *t) { return mpd2(t, scalb); }
192 int mpscalbf(struct t *t) { return mpf2(t, scalbf); }
193 int mpj0f(struct t *t) { return mpf1(t, j0f); }
194 int mpj0l(struct t *t) { return -1;}//mpl1(t, j0l); }
195 int mpj1f(struct t *t) { return mpf1(t, j1f); }
196 int mpj1l(struct t *t) { return -1;}//mpl1(t, j1l); }
197 int mpy0f(struct t *t) { return mpf1(t, y0f); }
198 int mpy0l(struct t *t) { return -1;}//mpl1(t, y0l); }
199 int mpy1f(struct t *t) { return mpf1(t, y1f); }
200 int mpy1l(struct t *t) { return -1;}//mpl1(t, y1l); }
201 int mpexp10(struct t *t) { return mpd1(t, exp10); }
202 int mpexp10f(struct t *t) { return mpf1(t, exp10f); }
203 int mpexp10l(struct t *t) { return mpl1(t, exp10l); }
204 int mppow10(struct t *t) { return mpd1(t, pow10); }
205 int mppow10f(struct t *t) { return mpf1(t, pow10f); }
206 int mppow10l(struct t *t) { return mpl1(t, pow10l); }
207
208 int mpfrexp(struct t *t)
209 {
210         int i;
211
212         t->dy = 0;
213         setupfenv(t->r);
214         t->y = frexp(t->x, &i);
215         t->e = getexcept();
216         t->i = i;
217         return 0;
218 }
219
220 int mpfrexpf(struct t *t)
221 {
222         int i;
223
224         t->dy = 0;
225         setupfenv(t->r);
226         t->y = frexpf(t->x, &i);
227         t->e = getexcept();
228         t->i = i;
229         return 0;
230 }
231
232 int mpfrexpl(struct t *t)
233 {
234         int i;
235
236         t->dy = 0;
237         setupfenv(t->r);
238         t->y = frexpl(t->x, &i);
239         t->e = getexcept();
240         t->i = i;
241         return 0;
242 }
243
244 int mpldexp(struct t *t)
245 {
246         t->dy = 0;
247         setupfenv(t->r);
248         t->y = ldexp(t->x, t->i);
249         t->e = getexcept();
250         return 0;
251 }
252
253 int mpldexpf(struct t *t)
254 {
255         t->dy = 0;
256         setupfenv(t->r);
257         t->y = ldexpf(t->x, t->i);
258         t->e = getexcept();
259         return 0;
260 }
261
262 int mpldexpl(struct t *t)
263 {
264         t->dy = 0;
265         setupfenv(t->r);
266         t->y = ldexpl(t->x, t->i);
267         t->e = getexcept();
268         return 0;
269 }
270
271 int mpscalbn(struct t *t)
272 {
273         t->dy = 0;
274         setupfenv(t->r);
275         t->y = scalbn(t->x, t->i);
276         t->e = getexcept();
277         return 0;
278 }
279
280 int mpscalbnf(struct t *t)
281 {
282         t->dy = 0;
283         setupfenv(t->r);
284         t->y = scalbnf(t->x, t->i);
285         t->e = getexcept();
286         return 0;
287 }
288
289 int mpscalbnl(struct t *t)
290 {
291         t->dy = 0;
292         setupfenv(t->r);
293         t->y = scalbnl(t->x, t->i);
294         t->e = getexcept();
295         return 0;
296 }
297
298 int mpscalbln(struct t *t)
299 {
300         t->dy = 0;
301         setupfenv(t->r);
302         t->y = scalbln(t->x, t->i);
303         t->e = getexcept();
304         return 0;
305 }
306
307 int mpscalblnf(struct t *t)
308 {
309         t->dy = 0;
310         setupfenv(t->r);
311         t->y = scalblnf(t->x, t->i);
312         t->e = getexcept();
313         return 0;
314 }
315
316 int mpscalblnl(struct t *t)
317 {
318         t->dy = 0;
319         setupfenv(t->r);
320         t->y = scalblnl(t->x, t->i);
321         t->e = getexcept();
322         return 0;
323 }
324
325 int mplgamma(struct t *t)
326 {
327         t->dy = 0;
328         setupfenv(t->r);
329         t->y = lgamma(t->x);
330         t->e = getexcept();
331         t->i = signgam;
332         return 0;
333 }
334
335 int mplgammaf(struct t *t)
336 {
337         t->dy = 0;
338         setupfenv(t->r);
339         t->y = lgammaf(t->x);
340         t->e = getexcept();
341         t->i = signgam;
342         return 0;
343 }
344
345 int mplgammal(struct t *t)
346 {
347         t->dy = 0;
348         setupfenv(t->r);
349         t->y = lgammal(t->x);
350         t->e = getexcept();
351         t->i = signgam;
352         return 0;
353 }
354
355 int mplgamma_r(struct t *t)
356 {
357         int i;
358
359         t->dy = 0;
360         setupfenv(t->r);
361         t->y = lgamma_r(t->x, &i);
362         t->e = getexcept();
363         t->i = i;
364         return 0;
365 }
366
367 int mplgammaf_r(struct t *t)
368 {
369         int i;
370
371         t->dy = 0;
372         setupfenv(t->r);
373         t->y = lgammaf_r(t->x, &i);
374         t->e = getexcept();
375         t->i = i;
376         return 0;
377 }
378
379 int mplgammal_r(struct t *t)
380 {
381         int i;
382
383         t->dy = 0;
384         setupfenv(t->r);
385         t->y = lgammal_r(t->x, &i);
386         t->e = getexcept();
387         t->i = i;
388         return 0;
389 }
390
391 int mpilogb(struct t *t)
392 {
393         setupfenv(t->r);
394         t->i = ilogb(t->x);
395         t->e = getexcept();
396         return 0;
397 }
398 int mpilogbf(struct t *t)
399 {
400         setupfenv(t->r);
401         t->i = ilogbf(t->x);
402         t->e = getexcept();
403         return 0;
404 }
405 int mpilogbl(struct t *t)
406 {
407         setupfenv(t->r);
408         t->i = ilogbl(t->x);
409         t->e = getexcept();
410         return 0;
411 }
412