3 static int mpf1(struct t
*s
, float (*f
)(float))
12 static int mpf2(struct t
*s
, float (*f
)(float,float))
16 s
->y
= f(s
->x
, s
->x2
);
21 static int mpd1(struct t
*s
, double (*f
)(double))
30 static int mpd2(struct t
*s
, double (*f
)(double, double))
34 s
->y
= f(s
->x
, s
->x2
);
39 static int mpl1(struct t
*s
, long double (*f
)(long double))
48 static int mpl2(struct t
*s
, long double (*f
)(long double, long double))
51 s
->y
= f(s
->x
, s
->x2
);
57 static double sinpi(double x
) { return sin(3.141592653589793238*x
); }
58 int mpsinpi(struct t
*t
) { return mpd1(t
, sinpi
); }
61 #define OP(n,op,t) static t n(t x, t y) { t z = x op y; return z; }
64 OP(addl
,+,long double)
67 OP(mull
,*,long double)
70 OP(divl
,/,long double)
71 int mpadd(struct t
*t
) { return mpd2(t
, add
); }
72 int mpaddf(struct t
*t
) { return mpf2(t
, addf
); }
73 int mpaddl(struct t
*t
) { return mpl2(t
, addl
); }
74 int mpmul(struct t
*t
) { return mpd2(t
, mul
); }
75 int mpmulf(struct t
*t
) { return mpf2(t
, mulf
); }
76 int mpmull(struct t
*t
) { return mpl2(t
, mull
); }
77 int mpdiv(struct t
*t
) { return mpd2(t
, div
); }
78 int mpdivf(struct t
*t
) { return mpf2(t
, divf
); }
79 int mpdivl(struct t
*t
) { return mpl2(t
, divl
); }
81 int mpacos(struct t
*t
) { return mpd1(t
, acos
); }
82 int mpacosf(struct t
*t
) { return mpf1(t
, acosf
); }
83 int mpacosl(struct t
*t
) { return mpl1(t
, acosl
); }
84 int mpacosh(struct t
*t
) { return mpd1(t
, acosh
); }
85 int mpacoshf(struct t
*t
) { return mpf1(t
, acoshf
); }
86 int mpacoshl(struct t
*t
) { return mpl1(t
, acoshl
); }
87 int mpasin(struct t
*t
) { return mpd1(t
, asin
); }
88 int mpasinf(struct t
*t
) { return mpf1(t
, asinf
); }
89 int mpasinl(struct t
*t
) { return mpl1(t
, asinl
); }
90 int mpasinh(struct t
*t
) { return mpd1(t
, asinh
); }
91 int mpasinhf(struct t
*t
) { return mpf1(t
, asinhf
); }
92 int mpasinhl(struct t
*t
) { return mpl1(t
, asinhl
); }
93 int mpatan(struct t
*t
) { return mpd1(t
, atan
); }
94 int mpatanf(struct t
*t
) { return mpf1(t
, atanf
); }
95 int mpatanl(struct t
*t
) { return mpl1(t
, atanl
); }
96 int mpatan2(struct t
*t
) { return mpd2(t
, atan2
); }
97 int mpatan2f(struct t
*t
) { return mpf2(t
, atan2f
); }
98 int mpatan2l(struct t
*t
) { return mpl2(t
, atan2l
); }
99 int mpatanh(struct t
*t
) { return mpd1(t
, atanh
); }
100 int mpatanhf(struct t
*t
) { return mpf1(t
, atanhf
); }
101 int mpatanhl(struct t
*t
) { return mpl1(t
, atanhl
); }
102 int mpcbrt(struct t
*t
) { return mpd1(t
, cbrt
); }
103 int mpcbrtf(struct t
*t
) { return mpf1(t
, cbrtf
); }
104 int mpcbrtl(struct t
*t
) { return mpl1(t
, cbrtl
); }
105 int mpceil(struct t
*t
) { return mpd1(t
, ceil
); }
106 int mpceilf(struct t
*t
) { return mpf1(t
, ceilf
); }
107 int mpceill(struct t
*t
) { return mpl1(t
, ceill
); }
108 int mpcopysign(struct t
*t
) { return mpd2(t
, copysign
); }
109 int mpcopysignf(struct t
*t
) { return mpf2(t
, copysignf
); }
110 int mpcopysignl(struct t
*t
) { return mpl2(t
, copysignl
); }
111 int mpcos(struct t
*t
) { return mpd1(t
, cos
); }
112 int mpcosf(struct t
*t
) { return mpf1(t
, cosf
); }
113 int mpcosl(struct t
*t
) { return mpl1(t
, cosl
); }
114 int mpcosh(struct t
*t
) { return mpd1(t
, cosh
); }
115 int mpcoshf(struct t
*t
) { return mpf1(t
, coshf
); }
116 int mpcoshl(struct t
*t
) { return mpl1(t
, coshl
); }
117 int mperf(struct t
*t
) { return mpd1(t
, erf
); }
118 int mperff(struct t
*t
) { return mpf1(t
, erff
); }
119 int mperfl(struct t
*t
) { return mpl1(t
, erfl
); }
120 int mperfc(struct t
*t
) { return mpd1(t
, erfc
); }
121 int mperfcf(struct t
*t
) { return mpf1(t
, erfcf
); }
122 int mperfcl(struct t
*t
) { return mpl1(t
, erfcl
); }
123 int mpexp(struct t
*t
) { return mpd1(t
, exp
); }
124 int mpexpf(struct t
*t
) { return mpf1(t
, expf
); }
125 int mpexpl(struct t
*t
) { return mpl1(t
, expl
); }
126 int mpexp2(struct t
*t
) { return mpd1(t
, exp2
); }
127 int mpexp2f(struct t
*t
) { return mpf1(t
, exp2f
); }
128 int mpexp2l(struct t
*t
) { return mpl1(t
, exp2l
); }
129 int mpexpm1(struct t
*t
) { return mpd1(t
, expm1
); }
130 int mpexpm1f(struct t
*t
) { return mpf1(t
, expm1f
); }
131 int mpexpm1l(struct t
*t
) { return mpl1(t
, expm1l
); }
132 int mpfabs(struct t
*t
) { return mpd1(t
, fabs
); }
133 int mpfabsf(struct t
*t
) { return mpf1(t
, fabsf
); }
134 int mpfabsl(struct t
*t
) { return mpl1(t
, fabsl
); }
135 int mpfdim(struct t
*t
) { return mpd2(t
, fdim
); }
136 int mpfdimf(struct t
*t
) { return mpf2(t
, fdimf
); }
137 int mpfdiml(struct t
*t
) { return mpl2(t
, fdiml
); }
138 int mpfloor(struct t
*t
) { return mpd1(t
, floor
); }
139 int mpfloorf(struct t
*t
) { return mpf1(t
, floorf
); }
140 int mpfloorl(struct t
*t
) { return mpl1(t
, floorl
); }
141 int mpfmax(struct t
*t
) { return mpd2(t
, fmax
); }
142 int mpfmaxf(struct t
*t
) { return mpf2(t
, fmaxf
); }
143 int mpfmaxl(struct t
*t
) { return mpl2(t
, fmaxl
); }
144 int mpfmin(struct t
*t
) { return mpd2(t
, fmin
); }
145 int mpfminf(struct t
*t
) { return mpf2(t
, fminf
); }
146 int mpfminl(struct t
*t
) { return mpl2(t
, fminl
); }
147 int mpfmod(struct t
*t
) { return mpd2(t
, fmod
); }
148 int mpfmodf(struct t
*t
) { return mpf2(t
, fmodf
); }
149 int mpfmodl(struct t
*t
) { return mpl2(t
, fmodl
); }
150 int mphypot(struct t
*t
) { return mpd2(t
, hypot
); }
151 int mphypotf(struct t
*t
) { return mpf2(t
, hypotf
); }
152 int mphypotl(struct t
*t
) { return mpl2(t
, hypotl
); }
153 int mplog(struct t
*t
) { return mpd1(t
, log
); }
154 int mplogf(struct t
*t
) { return mpf1(t
, logf
); }
155 int mplogl(struct t
*t
) { return mpl1(t
, logl
); }
156 int mplog10(struct t
*t
) { return mpd1(t
, log10
); }
157 int mplog10f(struct t
*t
) { return mpf1(t
, log10f
); }
158 int mplog10l(struct t
*t
) { return mpl1(t
, log10l
); }
159 int mplog1p(struct t
*t
) { return mpd1(t
, log1p
); }
160 int mplog1pf(struct t
*t
) { return mpf1(t
, log1pf
); }
161 int mplog1pl(struct t
*t
) { return mpl1(t
, log1pl
); }
162 int mplog2(struct t
*t
) { return mpd1(t
, log2
); }
163 int mplog2f(struct t
*t
) { return mpf1(t
, log2f
); }
164 int mplog2l(struct t
*t
) { return mpl1(t
, log2l
); }
165 int mplogb(struct t
*t
) { return mpd1(t
, logb
); }
166 int mplogbf(struct t
*t
) { return mpf1(t
, logbf
); }
167 int mplogbl(struct t
*t
) { return mpl1(t
, logbl
); }
168 int mpnearbyint(struct t
*t
) { return mpd1(t
, nearbyint
); }
169 int mpnearbyintf(struct t
*t
) { return mpf1(t
, nearbyintf
); }
170 int mpnearbyintl(struct t
*t
) { return mpl1(t
, nearbyintl
); }
171 int mpnextafter(struct t
*t
) { return mpd2(t
, nextafter
); }
172 int mpnextafterf(struct t
*t
) { return mpf2(t
, nextafterf
); }
173 int mpnextafterl(struct t
*t
) { return mpl2(t
, nextafterl
); }
174 int mpnexttoward(struct t
*t
)
176 feclearexcept(FE_ALL_EXCEPT
);
177 t
->y
= nexttoward(t
->x
, t
->x2
);
182 int mpnexttowardf(struct t
*t
)
184 feclearexcept(FE_ALL_EXCEPT
);
185 t
->y
= nexttowardf(t
->x
, t
->x2
);
190 int mpnexttowardl(struct t
*t
) { return mpl2(t
, nexttowardl
); }
191 int mppow(struct t
*t
) { return mpd2(t
, pow
); }
192 int mppowf(struct t
*t
) { return mpf2(t
, powf
); }
193 int mppowl(struct t
*t
) { return mpl2(t
, powl
); }
194 int mpremainder(struct t
*t
) { return mpd2(t
, remainder
); }
195 int mpremainderf(struct t
*t
) { return mpf2(t
, remainderf
); }
196 int mpremainderl(struct t
*t
) { return mpl2(t
, remainderl
); }
197 int mprint(struct t
*t
) { return mpd1(t
, rint
); }
198 int mprintf(struct t
*t
) { return mpf1(t
, rintf
); }
199 int mprintl(struct t
*t
) { return mpl1(t
, rintl
); }
200 int mpround(struct t
*t
) { return mpd1(t
, round
); }
201 int mproundf(struct t
*t
) { return mpf1(t
, roundf
); }
202 int mproundl(struct t
*t
) { return mpl1(t
, roundl
); }
203 int mpsin(struct t
*t
) { return mpd1(t
, sin
); }
204 int mpsinf(struct t
*t
) { return mpf1(t
, sinf
); }
205 int mpsinl(struct t
*t
) { return mpl1(t
, sinl
); }
206 int mpsinh(struct t
*t
) { return mpd1(t
, sinh
); }
207 int mpsinhf(struct t
*t
) { return mpf1(t
, sinhf
); }
208 int mpsinhl(struct t
*t
) { return mpl1(t
, sinhl
); }
209 int mpsqrt(struct t
*t
) { return mpd1(t
, sqrt
); }
210 int mpsqrtf(struct t
*t
) { return mpf1(t
, sqrtf
); }
211 int mpsqrtl(struct t
*t
) { return mpl1(t
, sqrtl
); }
212 int mptan(struct t
*t
) { return mpd1(t
, tan
); }
213 int mptanf(struct t
*t
) { return mpf1(t
, tanf
); }
214 int mptanl(struct t
*t
) { return mpl1(t
, tanl
); }
215 int mptanh(struct t
*t
) { return mpd1(t
, tanh
); }
216 int mptanhf(struct t
*t
) { return mpf1(t
, tanhf
); }
217 int mptanhl(struct t
*t
) { return mpl1(t
, tanhl
); }
218 int mptgamma(struct t
*t
) { return mpd1(t
, tgamma
); }
219 int mptgammaf(struct t
*t
) { return mpf1(t
, tgammaf
); }
220 int mptgammal(struct t
*t
) { return mpl1(t
, tgammal
); }
221 int mptrunc(struct t
*t
) { return mpd1(t
, trunc
); }
222 int mptruncf(struct t
*t
) { return mpf1(t
, truncf
); }
223 int mptruncl(struct t
*t
) { return mpl1(t
, truncl
); }
224 int mpj0(struct t
*t
) { return mpd1(t
, j0
); }
225 int mpj1(struct t
*t
) { return mpd1(t
, j1
); }
226 int mpy0(struct t
*t
) { return mpd1(t
, y0
); }
227 int mpy1(struct t
*t
) { return mpd1(t
, y1
); }
228 int mpscalb(struct t
*t
) { return mpd2(t
, scalb
); }
229 int mpscalbf(struct t
*t
) { return mpf2(t
, scalbf
); }
230 int mpj0f(struct t
*t
) { return mpf1(t
, j0f
); }
231 int mpj0l(struct t
*t
) { return -1;}//mpl1(t, j0l); }
232 int mpj1f(struct t
*t
) { return mpf1(t
, j1f
); }
233 int mpj1l(struct t
*t
) { return -1;}//mpl1(t, j1l); }
234 int mpy0f(struct t
*t
) { return mpf1(t
, y0f
); }
235 int mpy0l(struct t
*t
) { return -1;}//mpl1(t, y0l); }
236 int mpy1f(struct t
*t
) { return mpf1(t
, y1f
); }
237 int mpy1l(struct t
*t
) { return -1;}//mpl1(t, y1l); }
238 int mpexp10(struct t
*t
) { return mpd1(t
, exp10
); }
239 int mpexp10f(struct t
*t
) { return mpf1(t
, exp10f
); }
240 int mpexp10l(struct t
*t
) { return mpl1(t
, exp10l
); }
241 int mppow10(struct t
*t
) { return mpd1(t
, pow10
); }
242 int mppow10f(struct t
*t
) { return mpf1(t
, pow10f
); }
243 int mppow10l(struct t
*t
) { return mpl1(t
, pow10l
); }
246 int mp##n(struct t *t) \
250 t->y = n(t->x, t->i); \
251 t->e = getexcept(); \
266 int mp##n(struct t *t) \
271 t->y = n(t->x, &i); \
272 t->e = getexcept(); \
284 int mplgamma(struct t
*t
)
294 int mplgammaf(struct t
*t
)
298 t
->y
= lgammaf(t
->x
);
304 int mplgammal(struct t
*t
)
308 t
->y
= lgammal(t
->x
);
315 int mp##n(struct t *t) \
319 t->e = getexcept(); \
339 int mpmodf(struct t
*t
)
345 t
->y
= modf(t
->x
, &y2
);
351 int mpmodff(struct t
*t
)
357 t
->y
= modff(t
->x
, &y2
);
363 int mpmodfl(struct t
*t
)
367 t
->y
= modfl(t
->x
, &t
->y2
);
372 int mpsincos(struct t
*t
)
378 sincos(t
->x
, &y
, &y2
);
385 int mpsincosf(struct t
*t
)
391 sincosf(t
->x
, &y
, &y2
);
398 int mpsincosl(struct t
*t
)
402 sincosl(t
->x
, &t
->y
, &t
->y2
);
407 #define mp_ff_fi(n) \
408 int mp##n(struct t *t) \
413 t->y = n(t->x, t->x2, &i); \
414 t->e = getexcept(); \
423 #define mp_fff_f(n) \
424 int mp##n(struct t *t) \
428 t->y = n(t->x, t->x2, t->x3); \
429 t->e = getexcept(); \
438 int mp##n(struct t *t) \
442 t->y = n(t->i, t->x); \
443 t->e = getexcept(); \