1 #ifndef NPSTAT_STD_QUADMATH_HH_
2 #define NPSTAT_STD_QUADMATH_HH_
6 #define npstat_convert_to_complex128(from, to) \
8 __real__ to = (from).real(); \
9 __imag__ to = (from).imag();
11 #define npstat_adapt_float128_1arg_fcn(quadname, stdname) \
12 inline lapack_double stdname (const lapack_double c) \
14 return quadname (c); \
17 #define npstat_adapt_float128_2arg_fcn(quadname, stdname) \
18 inline lapack_double stdname (const lapack_double c1, \
19 const lapack_double c2) \
21 return quadname (c1, c2); \
24 #define npstat_adapt_complex128_1arg_fcn(quadname, stdname) \
25 inline std::complex<lapack_double> stdname ( \
26 const std::complex<lapack_double> c) \
28 npstat_convert_to_complex128(c, y); \
29 const __complex128 r = quadname (y); \
30 return std::complex<lapack_double>(__real__ r, __imag__ r);\
34 inline lapack_double abs(
const lapack_double c)
36 return c >= 0.0 ? c : -c;
39 npstat_adapt_float128_1arg_fcn(acosq, acos)
40 npstat_adapt_float128_1arg_fcn(acoshq, acosh)
41 npstat_adapt_float128_1arg_fcn(asinq, asin)
42 npstat_adapt_float128_1arg_fcn(asinhq, asinh)
43 npstat_adapt_float128_1arg_fcn(atanq, atan)
44 npstat_adapt_float128_1arg_fcn(atanhq, atanh)
45 npstat_adapt_float128_2arg_fcn(atan2q, atan2)
46 npstat_adapt_float128_1arg_fcn(cbrtq, cbrt)
47 npstat_adapt_float128_1arg_fcn(ceilq, ceil)
48 npstat_adapt_float128_2arg_fcn(copysignq, copysign)
49 npstat_adapt_float128_1arg_fcn(coshq, cosh)
50 npstat_adapt_float128_1arg_fcn(cosq, cos)
51 npstat_adapt_float128_1arg_fcn(erfq, erf)
52 npstat_adapt_float128_1arg_fcn(erfcq, erfc)
53 npstat_adapt_float128_1arg_fcn(expq, exp)
54 npstat_adapt_float128_1arg_fcn(expm1q, expm1)
55 npstat_adapt_float128_2arg_fcn(fmaxq, max)
56 npstat_adapt_float128_2arg_fcn(fminq, min)
57 npstat_adapt_float128_2arg_fcn(fmodq, mod)
58 npstat_adapt_float128_2arg_fcn(hypotq, hypot)
59 npstat_adapt_float128_1arg_fcn(j0q, j0)
60 npstat_adapt_float128_1arg_fcn(j1q, j1)
61 npstat_adapt_float128_1arg_fcn(lgammaq, lgamma)
62 npstat_adapt_float128_1arg_fcn(logq, log)
63 npstat_adapt_float128_1arg_fcn(log10q, log10)
64 npstat_adapt_float128_1arg_fcn(log2q, log2)
65 npstat_adapt_float128_1arg_fcn(log1pq, log1p)
66 npstat_adapt_float128_1arg_fcn(nearbyintq, nearbyint)
67 npstat_adapt_float128_2arg_fcn(nextafterq, nextafter)
68 npstat_adapt_float128_2arg_fcn(powq, pow)
69 npstat_adapt_float128_2arg_fcn(remainderq, remainder)
70 npstat_adapt_float128_1arg_fcn(rintq, rint)
71 npstat_adapt_float128_1arg_fcn(roundq, round)
72 npstat_adapt_float128_1arg_fcn(sinhq, sinh)
73 npstat_adapt_float128_1arg_fcn(sinq, sin)
74 npstat_adapt_float128_1arg_fcn(sqrtq, sqrt)
75 npstat_adapt_float128_1arg_fcn(tanq, tan)
76 npstat_adapt_float128_1arg_fcn(tanhq, tanh)
77 npstat_adapt_float128_1arg_fcn(tgammaq, tgamma)
78 npstat_adapt_float128_1arg_fcn(truncq, trunc)
79 npstat_adapt_float128_1arg_fcn(y0q, y0)
80 npstat_adapt_float128_1arg_fcn(y1q, y1)
82 inline int finite(
const lapack_double c)
87 inline int isinf(
const lapack_double c)
92 inline int isnan(
const lapack_double c)
97 inline int signbit(
const lapack_double c)
102 inline long long int llrint(
const lapack_double c)
107 inline long long int llround(
const lapack_double c)
112 inline long int lrint(
const lapack_double c)
117 inline long int lround(
const lapack_double c)
122 inline lapack_double abs(
const std::complex<lapack_double> c)
124 return hypotq(c.real(), c.imag());
127 inline lapack_double arg(
const std::complex<lapack_double> c)
129 npstat_convert_to_complex128(c, y);
133 inline std::complex<lapack_double> expi(
const lapack_double c)
135 const __complex128 r = cexpiq(c);
136 return std::complex<lapack_double>(__real__ r, __imag__ r);
139 npstat_adapt_complex128_1arg_fcn(cacosq, acos)
140 npstat_adapt_complex128_1arg_fcn(cacoshq, acosh)
141 npstat_adapt_complex128_1arg_fcn(casinq, asin)
142 npstat_adapt_complex128_1arg_fcn(casinhq, asinh)
143 npstat_adapt_complex128_1arg_fcn(catanq, atan)
144 npstat_adapt_complex128_1arg_fcn(catanhq, atanh)
145 npstat_adapt_complex128_1arg_fcn(ccosq, cos)
146 npstat_adapt_complex128_1arg_fcn(ccoshq, cosh)
147 npstat_adapt_complex128_1arg_fcn(cexpq, exp)
148 npstat_adapt_complex128_1arg_fcn(clogq, log)
149 npstat_adapt_complex128_1arg_fcn(clog10q, log10)
150 npstat_adapt_complex128_1arg_fcn(cprojq, proj)
151 npstat_adapt_complex128_1arg_fcn(csinq, sin)
152 npstat_adapt_complex128_1arg_fcn(csinhq, sinh)
153 npstat_adapt_complex128_1arg_fcn(csqrtq, sqrt)
154 npstat_adapt_complex128_1arg_fcn(ctanq, tan)
155 npstat_adapt_complex128_1arg_fcn(ctanhq, tanh)
157 inline std::complex<lapack_double> pow(
const std::complex<lapack_double> c1,
158 const std::complex<lapack_double> c2)
160 npstat_convert_to_complex128(c1, y1);
161 npstat_convert_to_complex128(c2, y2);
162 const __complex128 r = cpowq(y1, y2);
163 return std::complex<lapack_double>(__real__ r, __imag__ r);