Complete tgmath.h

This commit is contained in:
bumbread 2022-06-28 12:35:26 +11:00
parent 06aa9a096c
commit be2c9d132e
2 changed files with 87 additions and 76 deletions

View File

@ -9,14 +9,32 @@
#define _tg_is_ld2(x,y) (_tg_is_ld(x) || _tg_is_ld(y)) #define _tg_is_ld2(x,y) (_tg_is_ld(x) || _tg_is_ld(y))
#define _tg_is_d2(x,y) (_tg_is_d (x) || _tg_is_d (y)) #define _tg_is_d2(x,y) (_tg_is_d (x) || _tg_is_d (y))
#define _tg_is_ld3(x,y,z) (_tg_is_ld(x) || _tg_is_ld(y) || _tg_is_ld(z))
#define _tg_is_d3(x,y,z) (_tg_is_d (x) || _tg_is_d (y) || _tg_is_d (z))
#define _tg_func1(func,x) ( _tg_is_ld(x) ? (func ## l)(x) \ #define _tg_func1(func,x) ( _tg_is_ld(x) ? (func ## l)(x) \
: _tg_is_d(x) ? (func)(x) \ : _tg_is_d(x) ? (func)(x) \
: (func ## f)(x) ) : (func ## f)(x) )
#define _tf_func2(func, x, t) ( _tg_is_ld2(x,y) ? (func ## l)(x,y) \
#define _tg_func1p(func,x,p) ( _tg_is_ld(x) ? (func ## l)(x,p) \
: _tg_is_d(x) ? (func)(x,p) \
: (func ## f)(x,p) )
#define _tg_func2(func,x,y) ( _tg_is_ld2(x,y) ? (func ## l)(x,y) \
: _tg_is_d2(x,y) ? (func)(x,y) \ : _tg_is_d2(x,y) ? (func)(x,y) \
: (func ## f)(x,y) ) : (func ## f)(x,y) )
#define _tg_func2p(func,x,y,p) ( _tg_is_ld2(x,y) ? (func ## l)(x,y,p) \
: _tg_is_d2(x,y) ? (func)(x,y,p) \
: (func ## f)(x,y,p) )
#define _tg_func3(func,x,y,z) ( _tg_is_ld3(x,y,z) ? (func ## l)(x,y,z) \
: _tg_is_d3(x,y,z) ? (func)(x,y,z) \
: (func ## f)(x,y,z) )
#define cos(x) _tg_func1(cos, x) #define cos(x) _tg_func1(cos, x)
#define sin(x) _tg_func1(sin, x) #define sin(x) _tg_func1(sin, x)
#define tan(x) _tg_func1(tan, x) #define tan(x) _tg_func1(tan, x)
@ -34,55 +52,50 @@
#define exp(x) _tg_func1(exp, x) #define exp(x) _tg_func1(exp, x)
#define exp2(x) _tg_func1(exp2, x) #define exp2(x) _tg_func1(exp2, x)
#define expm1(x) _tg_func1(expm1, x)
#define pow(x,y) _tg_func2(pow, x, y) #define pow(x,y) _tg_func2(pow, x, y)
#define log(x,y) _tg_func2(log, x, y) #define log(x,y) _tg_func2(log, x, y)
#define sqrt(x) _tg_func1(sqrt, x) #define sqrt(x) _tg_func1(sqrt, x)
#define cbrt(x) _tg_func1(cbrt, x) #define cbrt(x) _tg_func1(cbrt, x)
#define fabs (x) _tg_func1(fabs, x) #define hypot(x,y) _tg_func2(hypot, x, y)
#define log10(x) _tg_func1(log10, x)
#define log1p(x) _tg_func1(log1p, x)
#define log2(x) _tg_func1(log2, x)
#define logb(x) _tg_func1(logb, x)
#define ilogb(x) _tg_func1(ilogb, x)
#define ceil(x) _tg_func1(ceil, x) #define ceil(x) _tg_func1(ceil, x)
#define floor(x) _tg_func1(floor, x) #define floor(x) _tg_func1(floor, x)
#define round (x) _tg_func1(round, x)
#define trunc(x) _tg_func1(trunc, x) #define trunc(x) _tg_func1(trunc, x)
#define llrint(x) _tg_func1(llrint, x)
#define lrint(x) _tg_func1(lrint, x)
#define rint(x) _tg_func1(rint, x)
#define llround(x) _tg_func1(llround, x)
#define lround(x) _tg_func1(lround, x)
#define round(x) _tg_func1(round, x)
#define nearbyint(x) _tg_func1(nearbyint, x)
#define copysign(x,y) _tg_func2(copysign, x, y) #define erf(x) _tg_func1(erf, x)
#define erfc(x) _tg_func1(erfc, x)
#define tgamma(x) _tg_func1(tgamma, x)
#define lgamma(x) _tg_func1(lgamma, x)
#define fabs(x) _tg_func1(fabs, x)
#define fdim(x,y) _tg_func2(fdim, x, y)
#define fmax(x,y) _tg_func2(fmax, x, y) #define fmax(x,y) _tg_func2(fmax, x, y)
#define fmin(x,y) _tg_func2(fmin, x, y) #define fmin(x,y) _tg_func2(fmin, x, y)
#define fmod(x,y) _tg_func2(fmod, x, y) #define fmod(x,y) _tg_func2(fmod, x, y)
#define remainder(x,y) _tg_func2(remainder, x, y)
#define remquo(x,y,p) _tg_func2p(remquo, x, y, p)
#define fma(x,y,z) _tg_func3(fma, x, y, z)
/* #define copysign(x,y) _tg_func2(copysign, x, y)
erf #define frexp(x,p) _tg_func1p(frexp, x, p)
erfc #define ldexp(x,p) _tg_func1p(ldexp, x, p)
exp2 #define modf(x,p) _tg_func1p(modf, x, p)
expm1 #define scalbn(x,p) _tg_func1p(scalbn, x, p)
fdim #define scalbln(x,p) _tg_func1p(scalbln, x, p)
fma
frexp #define nextafter(x,y) _tg_func2(nextafter, x, y)
hypot #define nexttoward(x,y) _tg_func2(nexttoward, x, y)
ilogb
ldexp
lgamma
llrint
llround
log10
log1p
log2
logb
lrint
lround
nearbyint
nextafter
nexttoward
remainder
remquo
rint
scalbn
scalbln
tgamma
carg
cimag
conj
cproj
creal
*/

8
todo
View File

@ -31,14 +31,12 @@ math.h:
other stuff? other stuff?
stdio.h: stdio.h:
Basically everything Formatted print, scan
stdlib.h: stdlib.h:
qsort Strtod base 16 must be correctly rounded
Multibyte string functions
Better PRNG Better PRNG
MB_CUR_MAX should be locale-dependent
strtod base 16 should be correctly rounded
Probably other stuff
threads.h: threads.h:
TODO: add todo items TODO: add todo items