riscv64-tok.h: update with more instructions from the spec
[tinycc.git] / include / tgmath.h
blob5d3e35781b4bae6700cf3c446d582ea9a019901b
1 /*
2 * ISO C Standard: 7.22 Type-generic math <tgmath.h>
3 */
5 #ifndef _TGMATH_H
6 #define _TGMATH_H
8 #include <math.h>
10 #ifndef __cplusplus
11 #define __tgmath_real(x, F) \
12 _Generic ((x), float: F##f, long double: F##l, default: F)(x)
13 #define __tgmath_real_2_1(x, y, F) \
14 _Generic ((x), float: F##f, long double: F##l, default: F)(x, y)
15 #define __tgmath_real_2(x, y, F) \
16 _Generic ((x)+(y), float: F##f, long double: F##l, default: F)(x, y)
17 #define __tgmath_real_3_2(x, y, z, F) \
18 _Generic ((x)+(y), float: F##f, long double: F##l, default: F)(x, y, z)
19 #define __tgmath_real_3(x, y, z, F) \
20 _Generic ((x)+(y)+(z), float: F##f, long double: F##l, default: F)(x, y, z)
22 /* Functions defined in both <math.h> and <complex.h> (7.22p4) */
23 #define acos(z) __tgmath_real(z, acos)
24 #define asin(z) __tgmath_real(z, asin)
25 #define atan(z) __tgmath_real(z, atan)
26 #define acosh(z) __tgmath_real(z, acosh)
27 #define asinh(z) __tgmath_real(z, asinh)
28 #define atanh(z) __tgmath_real(z, atanh)
29 #define cos(z) __tgmath_real(z, cos)
30 #define sin(z) __tgmath_real(z, sin)
31 #define tan(z) __tgmath_real(z, tan)
32 #define cosh(z) __tgmath_real(z, cosh)
33 #define sinh(z) __tgmath_real(z, sinh)
34 #define tanh(z) __tgmath_real(z, tanh)
35 #define exp(z) __tgmath_real(z, exp)
36 #define log(z) __tgmath_real(z, log)
37 #define pow(z1,z2) __tgmath_real_2(z1, z2, pow)
38 #define sqrt(z) __tgmath_real(z, sqrt)
39 #define fabs(z) __tgmath_real(z, fabs)
41 /* Functions defined in <math.h> only (7.22p5) */
42 #define atan2(x,y) __tgmath_real_2(x, y, atan2)
43 #define cbrt(x) __tgmath_real(x, cbrt)
44 #define ceil(x) __tgmath_real(x, ceil)
45 #define copysign(x,y) __tgmath_real_2(x, y, copysign)
46 #define erf(x) __tgmath_real(x, erf)
47 #define erfc(x) __tgmath_real(x, erfc)
48 #define exp2(x) __tgmath_real(x, exp2)
49 #define expm1(x) __tgmath_real(x, expm1)
50 #define fdim(x,y) __tgmath_real_2(x, y, fdim)
51 #define floor(x) __tgmath_real(x, floor)
52 #define fma(x,y,z) __tgmath_real_3(x, y, z, fma)
53 #define fmax(x,y) __tgmath_real_2(x, y, fmax)
54 #define fmin(x,y) __tgmath_real_2(x, y, fmin)
55 #define fmod(x,y) __tgmath_real_2(x, y, fmod)
56 #define frexp(x,y) __tgmath_real_2_1(x, y, frexp)
57 #define hypot(x,y) __tgmath_real_2(x, y, hypot)
58 #define ilogb(x) __tgmath_real(x, ilogb)
59 #define ldexp(x,y) __tgmath_real_2_1(x, y, ldexp)
60 #define lgamma(x) __tgmath_real(x, lgamma)
61 #define llrint(x) __tgmath_real(x, llrint)
62 #define llround(x) __tgmath_real(x, llround)
63 #define log10(x) __tgmath_real(x, log10)
64 #define log1p(x) __tgmath_real(x, log1p)
65 #define log2(x) __tgmath_real(x, log2)
66 #define logb(x) __tgmath_real(x, logb)
67 #define lrint(x) __tgmath_real(x, lrint)
68 #define lround(x) __tgmath_real(x, lround)
69 #define nearbyint(x) __tgmath_real(x, nearbyint)
70 #define nextafter(x,y) __tgmath_real_2(x, y, nextafter)
71 #define nexttoward(x,y) __tgmath_real_2(x, y, nexttoward)
72 #define remainder(x,y) __tgmath_real_2(x, y, remainder)
73 #define remquo(x,y,z) __tgmath_real_3_2(x, y, z, remquo)
74 #define rint(x) __tgmath_real(x, rint)
75 #define round(x) __tgmath_real(x, round)
76 #define scalbln(x,y) __tgmath_real_2_1(x, y, scalbln)
77 #define scalbn(x,y) __tgmath_real_2_1(x, y, scalbn)
78 #define tgamma(x) __tgmath_real(x, tgamma)
79 #define trunc(x) __tgmath_real(x, trunc)
81 /* Functions defined in <complex.h> only (7.22p6)
82 #define carg(z) __tgmath_cplx_only(z, carg)
83 #define cimag(z) __tgmath_cplx_only(z, cimag)
84 #define conj(z) __tgmath_cplx_only(z, conj)
85 #define cproj(z) __tgmath_cplx_only(z, cproj)
86 #define creal(z) __tgmath_cplx_only(z, creal)
88 #endif /* __cplusplus */
89 #endif /* _TGMATH_H */