Blame src/math/gen/mplibm.c

nsz f9d179
#include "gen.h"
nsz f9d179
nsz f9d179
#include <stdio.h>
nsz f9d179
static int mpf1(struct t *s, float (*f)(float))
nsz f9d179
{
nsz f9d179
	s->dy = 0;
nsz f9d179
	setupfenv(s->r);
nsz f9d179
	s->y = f(s->x);
nsz f9d179
	s->e = getexcept();
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
static int mpf2(struct t *s, float (*f)(float,float))
nsz f9d179
{
nsz f9d179
	s->dy = 0;
nsz f9d179
	setupfenv(s->r);
nsz f9d179
	s->y = f(s->x, s->x2);
nsz f9d179
	s->e = getexcept();
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
static int mpd1(struct t *s, double (*f)(double))
nsz f9d179
{
nsz f9d179
	s->dy = 0;
nsz f9d179
	setupfenv(s->r);
nsz f9d179
	s->y = f(s->x);
nsz f9d179
	s->e = getexcept();
nsz f9d179
//printf("%La %d\n", s->y, s->e);
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
static int mpd2(struct t *s, double (*f)(double, double))
nsz f9d179
{
nsz f9d179
	s->dy = 0;
nsz f9d179
	setupfenv(s->r);
nsz f9d179
	s->y = f(s->x, s->x2);
nsz f9d179
	s->e = getexcept();
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
static int mpl1(struct t *s, long double (*f)(long double))
nsz f9d179
{
nsz f9d179
	s->dy = 0;
nsz f9d179
	setupfenv(s->r);
nsz f9d179
	s->y = f(s->x);
nsz f9d179
	s->e = getexcept();
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
static int mpl2(struct t *s, long double (*f)(long double, long double))
nsz f9d179
{
nsz f9d179
	setupfenv(s->r);
nsz f9d179
	s->y = f(s->x, s->x2);
nsz f9d179
	s->dy = 0;
nsz f9d179
	s->e = getexcept();
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
nsz f9d179
int mpacos(struct t *t) { return mpd1(t, acos); }
nsz f9d179
int mpacosf(struct t *t) { return mpf1(t, acosf); }
nsz f9d179
int mpacosl(struct t *t) { return mpl1(t, acosl); }
nsz f9d179
int mpacosh(struct t *t) { return mpd1(t, acosh); }
nsz f9d179
int mpacoshf(struct t *t) { return mpf1(t, acoshf); }
nsz f9d179
int mpacoshl(struct t *t) { return mpl1(t, acoshl); }
nsz f9d179
int mpasin(struct t *t) { return mpd1(t, asin); }
nsz f9d179
int mpasinf(struct t *t) { return mpf1(t, asinf); }
nsz f9d179
int mpasinl(struct t *t) { return mpl1(t, asinl); }
nsz f9d179
int mpasinh(struct t *t) { return mpd1(t, asinh); }
nsz f9d179
int mpasinhf(struct t *t) { return mpf1(t, asinhf); }
nsz f9d179
int mpasinhl(struct t *t) { return mpl1(t, asinhl); }
nsz f9d179
int mpatan(struct t *t) { return mpd1(t, atan); }
nsz f9d179
int mpatanf(struct t *t) { return mpf1(t, atanf); }
nsz f9d179
int mpatanl(struct t *t) { return mpl1(t, atanl); }
nsz f9d179
int mpatan2(struct t *t) { return mpd2(t, atan2); }
nsz f9d179
int mpatan2f(struct t *t) { return mpf2(t, atan2f); }
nsz f9d179
int mpatan2l(struct t *t) { return mpl2(t, atan2l); }
nsz f9d179
int mpatanh(struct t *t) { return mpd1(t, atanh); }
nsz f9d179
int mpatanhf(struct t *t) { return mpf1(t, atanhf); }
nsz f9d179
int mpatanhl(struct t *t) { return mpl1(t, atanhl); }
nsz f9d179
int mpcbrt(struct t *t) { return mpd1(t, cbrt); }
nsz f9d179
int mpcbrtf(struct t *t) { return mpf1(t, cbrtf); }
nsz f9d179
int mpcbrtl(struct t *t) { return mpl1(t, cbrtl); }
nsz f9d179
int mpceil(struct t *t) { return mpd1(t, ceil); }
nsz f9d179
int mpceilf(struct t *t) { return mpf1(t, ceilf); }
nsz f9d179
int mpceill(struct t *t) { return mpl1(t, ceill); }
nsz f9d179
int mpcopysign(struct t *t) { return mpd2(t, copysign); }
nsz f9d179
int mpcopysignf(struct t *t) { return mpf2(t, copysignf); }
nsz f9d179
int mpcopysignl(struct t *t) { return mpl2(t, copysignl); }
nsz f9d179
int mpcos(struct t *t) { return mpd1(t, cos); }
nsz f9d179
int mpcosf(struct t *t) { return mpf1(t, cosf); }
nsz f9d179
int mpcosl(struct t *t) { return mpl1(t, cosl); }
nsz f9d179
int mpcosh(struct t *t) { return mpd1(t, cosh); }
nsz f9d179
int mpcoshf(struct t *t) { return mpf1(t, coshf); }
nsz f9d179
int mpcoshl(struct t *t) { return mpl1(t, coshl); }
nsz f9d179
int mperf(struct t *t) { return mpd1(t, erf); }
nsz f9d179
int mperff(struct t *t) { return mpf1(t, erff); }
nsz f9d179
int mperfl(struct t *t) { return mpl1(t, erfl); }
nsz f9d179
int mperfc(struct t *t) { return mpd1(t, erfc); }
nsz f9d179
int mperfcf(struct t *t) { return mpf1(t, erfcf); }
nsz f9d179
int mperfcl(struct t *t) { return mpl1(t, erfcl); }
nsz f9d179
int mpexp(struct t *t) { return mpd1(t, exp); }
nsz f9d179
int mpexpf(struct t *t) { return mpf1(t, expf); }
nsz f9d179
int mpexpl(struct t *t) { return mpl1(t, expl); }
nsz f9d179
int mpexp2(struct t *t) { return mpd1(t, exp2); }
nsz f9d179
int mpexp2f(struct t *t) { return mpf1(t, exp2f); }
nsz f9d179
int mpexp2l(struct t *t) { return mpl1(t, exp2l); }
nsz f9d179
int mpexpm1(struct t *t) { return mpd1(t, expm1); }
nsz f9d179
int mpexpm1f(struct t *t) { return mpf1(t, expm1f); }
nsz f9d179
int mpexpm1l(struct t *t) { return mpl1(t, expm1l); }
nsz f9d179
int mpfabs(struct t *t) { return mpd1(t, fabs); }
nsz f9d179
int mpfabsf(struct t *t) { return mpf1(t, fabsf); }
nsz f9d179
int mpfabsl(struct t *t) { return mpl1(t, fabsl); }
nsz f9d179
int mpfdim(struct t *t) { return mpd2(t, fdim); }
nsz f9d179
int mpfdimf(struct t *t) { return mpf2(t, fdimf); }
nsz f9d179
int mpfdiml(struct t *t) { return mpl2(t, fdiml); }
nsz f9d179
int mpfloor(struct t *t) { return mpd1(t, floor); }
nsz f9d179
int mpfloorf(struct t *t) { return mpf1(t, floorf); }
nsz f9d179
int mpfloorl(struct t *t) { return mpl1(t, floorl); }
nsz f9d179
int mpfmax(struct t *t) { return mpd2(t, fmax); }
nsz f9d179
int mpfmaxf(struct t *t) { return mpf2(t, fmaxf); }
nsz f9d179
int mpfmaxl(struct t *t) { return mpl2(t, fmaxl); }
nsz f9d179
int mpfmin(struct t *t) { return mpd2(t, fmin); }
nsz f9d179
int mpfminf(struct t *t) { return mpf2(t, fminf); }
nsz f9d179
int mpfminl(struct t *t) { return mpl2(t, fminl); }
nsz f9d179
int mpfmod(struct t *t) { return mpd2(t, fmod); }
nsz f9d179
int mpfmodf(struct t *t) { return mpf2(t, fmodf); }
nsz f9d179
int mpfmodl(struct t *t) { return mpl2(t, fmodl); }
nsz f9d179
int mphypot(struct t *t) { return mpd2(t, hypot); }
nsz f9d179
int mphypotf(struct t *t) { return mpf2(t, hypotf); }
nsz f9d179
int mphypotl(struct t *t) { return mpl2(t, hypotl); }
nsz f9d179
int mplog(struct t *t) { return mpd1(t, log); }
nsz f9d179
int mplogf(struct t *t) { return mpf1(t, logf); }
nsz f9d179
int mplogl(struct t *t) { return mpl1(t, logl); }
nsz f9d179
int mplog10(struct t *t) { return mpd1(t, log10); }
nsz f9d179
int mplog10f(struct t *t) { return mpf1(t, log10f); }
nsz f9d179
int mplog10l(struct t *t) { return mpl1(t, log10l); }
nsz f9d179
int mplog1p(struct t *t) { return mpd1(t, log1p); }
nsz f9d179
int mplog1pf(struct t *t) { return mpf1(t, log1pf); }
nsz f9d179
int mplog1pl(struct t *t) { return mpl1(t, log1pl); }
nsz f9d179
int mplog2(struct t *t) { return mpd1(t, log2); }
nsz f9d179
int mplog2f(struct t *t) { return mpf1(t, log2f); }
nsz f9d179
int mplog2l(struct t *t) { return mpl1(t, log2l); }
nsz f9d179
int mplogb(struct t *t) { return mpd1(t, logb); }
nsz f9d179
int mplogbf(struct t *t) { return mpf1(t, logbf); }
nsz f9d179
int mplogbl(struct t *t) { return mpl1(t, logbl); }
nsz f9d179
int mpnearbyint(struct t *t) { return mpd1(t, nearbyint); }
nsz f9d179
int mpnearbyintf(struct t *t) { return mpf1(t, nearbyintf); }
nsz f9d179
int mpnearbyintl(struct t *t) { return mpl1(t, nearbyintl); }
nsz f9d179
int mpnextafter(struct t *t) { return mpd2(t, nextafter); }
nsz f9d179
int mpnextafterf(struct t *t) { return mpf2(t, nextafterf); }
nsz f9d179
int mpnextafterl(struct t *t) { return mpl2(t, nextafterl); }
nsz f9d179
int mpnexttowardl(struct t *t) { return mpl2(t, nexttowardl); }
nsz f9d179
int mppow(struct t *t) { return mpd2(t, pow); }
nsz f9d179
int mppowf(struct t *t) { return mpf2(t, powf); }
nsz f9d179
int mppowl(struct t *t) { return mpl2(t, powl); }
nsz f9d179
int mpremainder(struct t *t) { return mpd2(t, remainder); }
nsz f9d179
int mpremainderf(struct t *t) { return mpf2(t, remainderf); }
nsz f9d179
int mpremainderl(struct t *t) { return mpl2(t, remainderl); }
nsz f9d179
int mprint(struct t *t) { return mpd1(t, rint); }
nsz f9d179
int mprintf(struct t *t) { return mpf1(t, rintf); }
nsz f9d179
int mprintl(struct t *t) { return mpl1(t, rintl); }
nsz f9d179
int mpround(struct t *t) { return mpd1(t, round); }
nsz f9d179
int mproundf(struct t *t) { return mpf1(t, roundf); }
nsz f9d179
int mproundl(struct t *t) { return mpl1(t, roundl); }
nsz f9d179
int mpsin(struct t *t) { return mpd1(t, sin); }
nsz f9d179
int mpsinf(struct t *t) { return mpf1(t, sinf); }
nsz f9d179
int mpsinl(struct t *t) { return mpl1(t, sinl); }
nsz f9d179
int mpsinh(struct t *t) { return mpd1(t, sinh); }
nsz f9d179
int mpsinhf(struct t *t) { return mpf1(t, sinhf); }
nsz f9d179
int mpsinhl(struct t *t) { return mpl1(t, sinhl); }
nsz f9d179
int mpsqrt(struct t *t) { return mpd1(t, sqrt); }
nsz f9d179
int mpsqrtf(struct t *t) { return mpf1(t, sqrtf); }
nsz f9d179
int mpsqrtl(struct t *t) { return mpl1(t, sqrtl); }
nsz f9d179
int mptan(struct t *t) { return mpd1(t, tan); }
nsz f9d179
int mptanf(struct t *t) { return mpf1(t, tanf); }
nsz f9d179
int mptanl(struct t *t) { return mpl1(t, tanl); }
nsz f9d179
int mptanh(struct t *t) { return mpd1(t, tanh); }
nsz f9d179
int mptanhf(struct t *t) { return mpf1(t, tanhf); }
nsz f9d179
int mptanhl(struct t *t) { return mpl1(t, tanhl); }
nsz f9d179
int mptgamma(struct t *t) { return mpd1(t, tgamma); }
nsz f9d179
int mptgammaf(struct t *t) { return mpf1(t, tgammaf); }
nsz f9d179
int mptgammal(struct t *t) { return mpl1(t, tgammal); }
nsz f9d179
int mptrunc(struct t *t) { return mpd1(t, trunc); }
nsz f9d179
int mptruncf(struct t *t) { return mpf1(t, truncf); }
nsz f9d179
int mptruncl(struct t *t) { return mpl1(t, truncl); }
nsz f9d179
int mpj0(struct t *t) { return mpd1(t, j0); }
nsz f9d179
int mpj1(struct t *t) { return mpd1(t, j1); }
nsz f9d179
int mpy0(struct t *t) { return mpd1(t, y0); }
nsz f9d179
int mpy1(struct t *t) { return mpd1(t, y1); }
nsz f9d179
int mpscalb(struct t *t) { return mpd2(t, scalb); }
nsz f9d179
int mpscalbf(struct t *t) { return mpf2(t, scalbf); }
nsz f9d179
int mpj0f(struct t *t) { return mpf1(t, j0f); }
nsz f9d179
int mpj0l(struct t *t) { return -1;}//mpl1(t, j0l); }
nsz f9d179
int mpj1f(struct t *t) { return mpf1(t, j1f); }
nsz f9d179
int mpj1l(struct t *t) { return -1;}//mpl1(t, j1l); }
nsz f9d179
int mpy0f(struct t *t) { return mpf1(t, y0f); }
nsz f9d179
int mpy0l(struct t *t) { return -1;}//mpl1(t, y0l); }
nsz f9d179
int mpy1f(struct t *t) { return mpf1(t, y1f); }
nsz f9d179
int mpy1l(struct t *t) { return -1;}//mpl1(t, y1l); }
nsz f9d179
int mpexp10(struct t *t) { return mpd1(t, exp10); }
nsz f9d179
int mpexp10f(struct t *t) { return mpf1(t, exp10f); }
nsz f9d179
int mpexp10l(struct t *t) { return mpl1(t, exp10l); }
nsz f9d179
int mppow10(struct t *t) { return mpd1(t, pow10); }
nsz f9d179
int mppow10f(struct t *t) { return mpf1(t, pow10f); }
nsz f9d179
int mppow10l(struct t *t) { return mpl1(t, pow10l); }
nsz f9d179
nsz f9d179
int mpfrexp(struct t *t)
nsz f9d179
{
nsz f9d179
	int i;
nsz f9d179
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = frexp(t->x, &i);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	t->i = i;
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mpfrexpf(struct t *t)
nsz f9d179
{
nsz f9d179
	int i;
nsz f9d179
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = frexpf(t->x, &i);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	t->i = i;
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mpfrexpl(struct t *t)
nsz f9d179
{
nsz f9d179
	int i;
nsz f9d179
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = frexpl(t->x, &i);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	t->i = i;
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mpldexp(struct t *t)
nsz f9d179
{
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = ldexp(t->x, t->i);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mpldexpf(struct t *t)
nsz f9d179
{
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = ldexpf(t->x, t->i);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mpldexpl(struct t *t)
nsz f9d179
{
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = ldexpl(t->x, t->i);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mpscalbn(struct t *t)
nsz f9d179
{
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = scalbn(t->x, t->i);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mpscalbnf(struct t *t)
nsz f9d179
{
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = scalbnf(t->x, t->i);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mpscalbnl(struct t *t)
nsz f9d179
{
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = scalbnl(t->x, t->i);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mpscalbln(struct t *t)
nsz f9d179
{
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = scalbln(t->x, t->i);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mpscalblnf(struct t *t)
nsz f9d179
{
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = scalblnf(t->x, t->i);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mpscalblnl(struct t *t)
nsz f9d179
{
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = scalblnl(t->x, t->i);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mplgamma(struct t *t)
nsz f9d179
{
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = lgamma(t->x);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	t->i = signgam;
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mplgammaf(struct t *t)
nsz f9d179
{
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = lgammaf(t->x);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	t->i = signgam;
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mplgammal(struct t *t)
nsz f9d179
{
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = lgammal(t->x);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	t->i = signgam;
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mplgamma_r(struct t *t)
nsz f9d179
{
nsz f9d179
	int i;
nsz f9d179
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = lgamma_r(t->x, &i);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	t->i = i;
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mplgammaf_r(struct t *t)
nsz f9d179
{
nsz f9d179
	int i;
nsz f9d179
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = lgammaf_r(t->x, &i);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	t->i = i;
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179
nsz f9d179
int mplgammal_r(struct t *t)
nsz f9d179
{
nsz f9d179
	int i;
nsz f9d179
nsz f9d179
	t->dy = 0;
nsz f9d179
	setupfenv(t->r);
nsz f9d179
	t->y = lgammal_r(t->x, &i);
nsz f9d179
	t->e = getexcept();
nsz f9d179
	t->i = i;
nsz f9d179
	return 0;
nsz f9d179
}
nsz f9d179