Debian Codegraph @

third-party/boost-math/include/boost/math/cstdfloat/cstdfloat_cmath.hpp

raw
1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright Christopher Kormanyos 2014.
3 // Copyright John Maddock 2014.
4 // Copyright Paul Bristow 2014.
5 // Distributed under the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt
7 // or copy at http://www.boost.org/LICENSE_1_0.txt)
8 //
9
10 // Implement quadruple-precision <cmath> support.
11
12 #ifndef BOOST_MATH_CSTDFLOAT_CMATH_2014_02_15_HPP_
13 #define BOOST_MATH_CSTDFLOAT_CMATH_2014_02_15_HPP_
14
15 #include <boost/math/cstdfloat/cstdfloat_types.hpp>
16 #include <boost/math/cstdfloat/cstdfloat_limits.hpp>
17
18 #if (defined(__GNUC__) && defined(BOOST_HAS_FLOAT128))
19 //
20 // This is the only way we can avoid
21 // warning: non-standard suffix on floating constant [-Wpedantic]
22 // when building with -Wall -pedantic. Neither __extension__
23 // nor #pragma diagnostic ignored work :(
24 //
25 #pragma GCC system_header
26 #endif
27
28 #if defined(BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T) && defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT)
29
30 #include <cstdint>
31 #include <cmath>
32 #include <stdexcept>
33 #include <iostream>
34 #include <type_traits>
35 #include <memory>
36 #include <boost/math/tools/assert.hpp>
37 #include <boost/math/tools/nothrow.hpp>
38 #include <boost/math/tools/throw_exception.hpp>
39
40 #if defined(_WIN32) && defined(__GNUC__)
41 // Several versions of Mingw and probably cygwin too have broken
42 // libquadmath implementations that segfault as soon as you call
43 // expq or any function that depends on it.
44 #define BOOST_CSTDFLOAT_BROKEN_FLOAT128_MATH_FUNCTIONS
45 #endif
46
47 // Here is a helper function used for raising the value of a given
48 // floating-point type to the power of n, where n has integral type.
49 namespace boost {
50 namespace math {
51 namespace cstdfloat {
52 namespace detail {
53
54 template<class float_type, class integer_type>
55 inline float_type pown(const float_type& x, const integer_type p)
56 {
57 const bool isneg = (x < 0);
58 const bool isnan = (x != x);
59 const bool isinf = ((!isneg) ? bool(+x > (std::numeric_limits<float_type>::max)())
60 : bool(-x > (std::numeric_limits<float_type>::max)()));
61
62 if (isnan) { return x; }
63
64 if (isinf) { return std::numeric_limits<float_type>::quiet_NaN(); }
65
66 const bool x_is_neg = (x < 0);
67 const float_type abs_x = (x_is_neg ? -x : x);
68
69 if (p < static_cast<integer_type>(0))
70 {
71 if (abs_x < (std::numeric_limits<float_type>::min)())
72 {
73 return (x_is_neg ? -std::numeric_limits<float_type>::infinity()
74 : +std::numeric_limits<float_type>::infinity());
75 }
76 else
77 {
78 return float_type(1) / pown(x, static_cast<integer_type>(-p));
79 }
80 }
81
82 if (p == static_cast<integer_type>(0))
83 {
84 return float_type(1);
85 }
86 else
87 {
88 if (p == static_cast<integer_type>(1)) { return x; }
89
90 if (abs_x > (std::numeric_limits<float_type>::max)())
91 {
92 return (x_is_neg ? -std::numeric_limits<float_type>::infinity()
93 : +std::numeric_limits<float_type>::infinity());
94 }
95
96 if (p == static_cast<integer_type>(2)) { return (x * x); }
97 else if (p == static_cast<integer_type>(3)) { return ((x * x) * x); }
98 else if (p == static_cast<integer_type>(4)) { const float_type x2 = (x * x); return (x2 * x2); }
99 else
100 {
101 // The variable xn stores the binary powers of x.
102 float_type result(((p % integer_type(2)) != integer_type(0)) ? x : float_type(1));
103 float_type xn(x);
104
105 integer_type p2 = p;
106
107 while (integer_type(p2 /= 2) != integer_type(0))
108 {
109 // Square xn for each binary power.
110 xn *= xn;
111
112 const bool has_binary_power = (integer_type(p2 % integer_type(2)) != integer_type(0));
113
114 if (has_binary_power)
115 {
116 // Multiply the result with each binary power contained in the exponent.
117 result *= xn;
118 }
119 }
120
121 return result;
122 }
123 }
124 }
125
126 }
127 }
128 }
129 } // boost::math::cstdfloat::detail
130
131 // We will now define preprocessor symbols representing quadruple-precision <cmath> functions.
132 #if defined(__INTEL_COMPILER)
133 #define BOOST_CSTDFLOAT_FLOAT128_LDEXP __ldexpq
134 #define BOOST_CSTDFLOAT_FLOAT128_FREXP __frexpq
135 #define BOOST_CSTDFLOAT_FLOAT128_FABS __fabsq
136 #define BOOST_CSTDFLOAT_FLOAT128_FLOOR __floorq
137 #define BOOST_CSTDFLOAT_FLOAT128_CEIL __ceilq
138 #if !defined(BOOST_CSTDFLOAT_FLOAT128_SQRT)
139 #define BOOST_CSTDFLOAT_FLOAT128_SQRT __sqrtq
140 #endif
141 #define BOOST_CSTDFLOAT_FLOAT128_TRUNC __truncq
142 #define BOOST_CSTDFLOAT_FLOAT128_EXP __expq
143 #define BOOST_CSTDFLOAT_FLOAT128_EXPM1 __expm1q
144 #define BOOST_CSTDFLOAT_FLOAT128_POW __powq
145 #define BOOST_CSTDFLOAT_FLOAT128_LOG __logq
146 #define BOOST_CSTDFLOAT_FLOAT128_LOG10 __log10q
147 #define BOOST_CSTDFLOAT_FLOAT128_SIN __sinq
148 #define BOOST_CSTDFLOAT_FLOAT128_COS __cosq
149 #define BOOST_CSTDFLOAT_FLOAT128_TAN __tanq
150 #define BOOST_CSTDFLOAT_FLOAT128_ASIN __asinq
151 #define BOOST_CSTDFLOAT_FLOAT128_ACOS __acosq
152 #define BOOST_CSTDFLOAT_FLOAT128_ATAN __atanq
153 #define BOOST_CSTDFLOAT_FLOAT128_SINH __sinhq
154 #define BOOST_CSTDFLOAT_FLOAT128_COSH __coshq
155 #define BOOST_CSTDFLOAT_FLOAT128_TANH __tanhq
156 #define BOOST_CSTDFLOAT_FLOAT128_ASINH __asinhq
157 #define BOOST_CSTDFLOAT_FLOAT128_ACOSH __acoshq
158 #define BOOST_CSTDFLOAT_FLOAT128_ATANH __atanhq
159 #define BOOST_CSTDFLOAT_FLOAT128_FMOD __fmodq
160 #define BOOST_CSTDFLOAT_FLOAT128_ATAN2 __atan2q
161 #define BOOST_CSTDFLOAT_FLOAT128_LGAMMA __lgammaq
162 #define BOOST_CSTDFLOAT_FLOAT128_TGAMMA __tgammaq
163 // begin more functions
164 #define BOOST_CSTDFLOAT_FLOAT128_REMAINDER __remainderq
165 #define BOOST_CSTDFLOAT_FLOAT128_REMQUO __remquoq
166 #define BOOST_CSTDFLOAT_FLOAT128_FMA __fmaq
167 #define BOOST_CSTDFLOAT_FLOAT128_FMAX __fmaxq
168 #define BOOST_CSTDFLOAT_FLOAT128_FMIN __fminq
169 #define BOOST_CSTDFLOAT_FLOAT128_FDIM __fdimq
170 #define BOOST_CSTDFLOAT_FLOAT128_NAN __nanq
171 //#define BOOST_CSTDFLOAT_FLOAT128_EXP2 __exp2q
172 #define BOOST_CSTDFLOAT_FLOAT128_LOG2 __log2q
173 #define BOOST_CSTDFLOAT_FLOAT128_LOG1P __log1pq
174 #define BOOST_CSTDFLOAT_FLOAT128_CBRT __cbrtq
175 #define BOOST_CSTDFLOAT_FLOAT128_HYPOT __hypotq
176 #define BOOST_CSTDFLOAT_FLOAT128_ERF __erfq
177 #define BOOST_CSTDFLOAT_FLOAT128_ERFC __erfcq
178 #define BOOST_CSTDFLOAT_FLOAT128_LLROUND __llroundq
179 #define BOOST_CSTDFLOAT_FLOAT128_LROUND __lroundq
180 #define BOOST_CSTDFLOAT_FLOAT128_ROUND __roundq
181 #define BOOST_CSTDFLOAT_FLOAT128_NEARBYINT __nearbyintq
182 #define BOOST_CSTDFLOAT_FLOAT128_LLRINT __llrintq
183 #define BOOST_CSTDFLOAT_FLOAT128_LRINT __lrintq
184 #define BOOST_CSTDFLOAT_FLOAT128_RINT __rintq
185 #define BOOST_CSTDFLOAT_FLOAT128_MODF __modfq
186 #define BOOST_CSTDFLOAT_FLOAT128_SCALBLN __scalblnq
187 #define BOOST_CSTDFLOAT_FLOAT128_SCALBN __scalbnq
188 #define BOOST_CSTDFLOAT_FLOAT128_ILOGB __ilogbq
189 #define BOOST_CSTDFLOAT_FLOAT128_LOGB __logbq
190 #define BOOST_CSTDFLOAT_FLOAT128_NEXTAFTER __nextafterq
191 //#define BOOST_CSTDFLOAT_FLOAT128_NEXTTOWARD __nexttowardq
192 #define BOOST_CSTDFLOAT_FLOAT128_COPYSIGN __copysignq
193 #define BOOST_CSTDFLOAT_FLOAT128_SIGNBIT __signbitq
194 //#define BOOST_CSTDFLOAT_FLOAT128_FPCLASSIFY __fpclassifyq
195 //#define BOOST_CSTDFLOAT_FLOAT128_ISFINITE __isfiniteq
196 #define BOOST_CSTDFLOAT_FLOAT128_ISINF __isinfq
197 #define BOOST_CSTDFLOAT_FLOAT128_ISNAN __isnanq
198 //#define BOOST_CSTDFLOAT_FLOAT128_ISNORMAL __isnormalq
199 //#define BOOST_CSTDFLOAT_FLOAT128_ISGREATER __isgreaterq
200 //#define BOOST_CSTDFLOAT_FLOAT128_ISGREATEREQUAL __isgreaterequalq
201 //#define BOOST_CSTDFLOAT_FLOAT128_ISLESS __islessq
202 //#define BOOST_CSTDFLOAT_FLOAT128_ISLESSEQUAL __islessequalq
203 //#define BOOST_CSTDFLOAT_FLOAT128_ISLESSGREATER __islessgreaterq
204 //#define BOOST_CSTDFLOAT_FLOAT128_ISUNORDERED __isunorderedq
205 // end more functions
206 #elif defined(__GNUC__)
207 #define BOOST_CSTDFLOAT_FLOAT128_LDEXP ldexpq
208 #define BOOST_CSTDFLOAT_FLOAT128_FREXP frexpq
209 #define BOOST_CSTDFLOAT_FLOAT128_FABS fabsq
210 #define BOOST_CSTDFLOAT_FLOAT128_FLOOR floorq
211 #define BOOST_CSTDFLOAT_FLOAT128_CEIL ceilq
212 #if !defined(BOOST_CSTDFLOAT_FLOAT128_SQRT)
213 #define BOOST_CSTDFLOAT_FLOAT128_SQRT sqrtq
214 #endif
215 #define BOOST_CSTDFLOAT_FLOAT128_TRUNC truncq
216 #define BOOST_CSTDFLOAT_FLOAT128_POW powq
217 #define BOOST_CSTDFLOAT_FLOAT128_LOG logq
218 #define BOOST_CSTDFLOAT_FLOAT128_LOG10 log10q
219 #define BOOST_CSTDFLOAT_FLOAT128_SIN sinq
220 #define BOOST_CSTDFLOAT_FLOAT128_COS cosq
221 #define BOOST_CSTDFLOAT_FLOAT128_TAN tanq
222 #define BOOST_CSTDFLOAT_FLOAT128_ASIN asinq
223 #define BOOST_CSTDFLOAT_FLOAT128_ACOS acosq
224 #define BOOST_CSTDFLOAT_FLOAT128_ATAN atanq
225 #define BOOST_CSTDFLOAT_FLOAT128_FMOD fmodq
226 #define BOOST_CSTDFLOAT_FLOAT128_ATAN2 atan2q
227 #define BOOST_CSTDFLOAT_FLOAT128_LGAMMA lgammaq
228 #if !defined(BOOST_CSTDFLOAT_BROKEN_FLOAT128_MATH_FUNCTIONS)
229 #define BOOST_CSTDFLOAT_FLOAT128_EXP expq
230 #define BOOST_CSTDFLOAT_FLOAT128_EXPM1 expm1q
231 #define BOOST_CSTDFLOAT_FLOAT128_SINH sinhq
232 #define BOOST_CSTDFLOAT_FLOAT128_COSH coshq
233 #define BOOST_CSTDFLOAT_FLOAT128_TANH tanhq
234 #define BOOST_CSTDFLOAT_FLOAT128_ASINH asinhq
235 #define BOOST_CSTDFLOAT_FLOAT128_ACOSH acoshq
236 #define BOOST_CSTDFLOAT_FLOAT128_ATANH atanhq
237 #define BOOST_CSTDFLOAT_FLOAT128_TGAMMA tgammaq
238 #else // BOOST_CSTDFLOAT_BROKEN_FLOAT128_MATH_FUNCTIONS
239 #define BOOST_CSTDFLOAT_FLOAT128_EXP expq_patch
240 #define BOOST_CSTDFLOAT_FLOAT128_SINH sinhq_patch
241 #define BOOST_CSTDFLOAT_FLOAT128_COSH coshq_patch
242 #define BOOST_CSTDFLOAT_FLOAT128_TANH tanhq_patch
243 #define BOOST_CSTDFLOAT_FLOAT128_ASINH asinhq_patch
244 #define BOOST_CSTDFLOAT_FLOAT128_ACOSH acoshq_patch
245 #define BOOST_CSTDFLOAT_FLOAT128_ATANH atanhq_patch
246 #define BOOST_CSTDFLOAT_FLOAT128_TGAMMA tgammaq_patch
247 #endif // BOOST_CSTDFLOAT_BROKEN_FLOAT128_MATH_FUNCTIONS
248 // begin more functions
249 #define BOOST_CSTDFLOAT_FLOAT128_REMAINDER remainderq
250 #define BOOST_CSTDFLOAT_FLOAT128_REMQUO remquoq
251 #define BOOST_CSTDFLOAT_FLOAT128_FMA fmaq
252 #define BOOST_CSTDFLOAT_FLOAT128_FMAX fmaxq
253 #define BOOST_CSTDFLOAT_FLOAT128_FMIN fminq
254 #define BOOST_CSTDFLOAT_FLOAT128_FDIM fdimq
255 #define BOOST_CSTDFLOAT_FLOAT128_NAN nanq
256 //#define BOOST_CSTDFLOAT_FLOAT128_EXP2 exp2q
257 #define BOOST_CSTDFLOAT_FLOAT128_LOG2 log2q
258 #define BOOST_CSTDFLOAT_FLOAT128_LOG1P log1pq
259 #define BOOST_CSTDFLOAT_FLOAT128_CBRT cbrtq
260 #define BOOST_CSTDFLOAT_FLOAT128_HYPOT hypotq
261 #define BOOST_CSTDFLOAT_FLOAT128_ERF erfq
262 #define BOOST_CSTDFLOAT_FLOAT128_ERFC erfcq
263 #define BOOST_CSTDFLOAT_FLOAT128_LLROUND llroundq
264 #define BOOST_CSTDFLOAT_FLOAT128_LROUND lroundq
265 #define BOOST_CSTDFLOAT_FLOAT128_ROUND roundq
266 #define BOOST_CSTDFLOAT_FLOAT128_NEARBYINT nearbyintq
267 #define BOOST_CSTDFLOAT_FLOAT128_LLRINT llrintq
268 #define BOOST_CSTDFLOAT_FLOAT128_LRINT lrintq
269 #define BOOST_CSTDFLOAT_FLOAT128_RINT rintq
270 #define BOOST_CSTDFLOAT_FLOAT128_MODF modfq
271 #define BOOST_CSTDFLOAT_FLOAT128_SCALBLN scalblnq
272 #define BOOST_CSTDFLOAT_FLOAT128_SCALBN scalbnq
273 #define BOOST_CSTDFLOAT_FLOAT128_ILOGB ilogbq
274 #define BOOST_CSTDFLOAT_FLOAT128_LOGB logbq
275 #define BOOST_CSTDFLOAT_FLOAT128_NEXTAFTER nextafterq
276 //#define BOOST_CSTDFLOAT_FLOAT128_NEXTTOWARD nexttowardq
277 #define BOOST_CSTDFLOAT_FLOAT128_COPYSIGN copysignq
278 #define BOOST_CSTDFLOAT_FLOAT128_SIGNBIT signbitq
279 //#define BOOST_CSTDFLOAT_FLOAT128_FPCLASSIFY fpclassifyq
280 //#define BOOST_CSTDFLOAT_FLOAT128_ISFINITE isfiniteq
281 #define BOOST_CSTDFLOAT_FLOAT128_ISINF isinfq
282 #define BOOST_CSTDFLOAT_FLOAT128_ISNAN isnanq
283 //#define BOOST_CSTDFLOAT_FLOAT128_ISNORMAL isnormalq
284 //#define BOOST_CSTDFLOAT_FLOAT128_ISGREATER isgreaterq
285 //#define BOOST_CSTDFLOAT_FLOAT128_ISGREATEREQUAL isgreaterequalq
286 //#define BOOST_CSTDFLOAT_FLOAT128_ISLESS islessq
287 //#define BOOST_CSTDFLOAT_FLOAT128_ISLESSEQUAL islessequalq
288 //#define BOOST_CSTDFLOAT_FLOAT128_ISLESSGREATER islessgreaterq
289 //#define BOOST_CSTDFLOAT_FLOAT128_ISUNORDERED isunorderedq
290 // end more functions
291 #endif
292
293 // Implement quadruple-precision <cmath> functions in the namespace
294 // boost::math::cstdfloat::detail. Subsequently inject these into the
295 // std namespace via *using* directive.
296
297 // Begin with some forward function declarations. Also implement patches
298 // for compilers that have broken float128 exponential functions.
299
300 extern "C" int quadmath_snprintf(char*, std::size_t, const char*, ...) BOOST_MATH_NOTHROW;
301
302 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_LDEXP(boost::math::cstdfloat::detail::float_internal128_t, int) BOOST_MATH_NOTHROW;
303 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FREXP(boost::math::cstdfloat::detail::float_internal128_t, int*) BOOST_MATH_NOTHROW;
304 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FABS(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
305 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FLOOR(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
306 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_CEIL(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
307 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SQRT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
308 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_TRUNC(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
309 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_POW(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
310 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_LOG(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
311 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_LOG10(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
312 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SIN(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
313 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_COS(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
314 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_TAN(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
315 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ASIN(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
316 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ACOS(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
317 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ATAN(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
318 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FMOD(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
319 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ATAN2(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
320 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_LGAMMA(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
321
322 // begin more functions
323 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_REMAINDER(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
324 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_REMQUO(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t, int*) BOOST_MATH_NOTHROW;
325 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FMA(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
326 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FMAX(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
327 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FMIN(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
328 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FDIM(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
329 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_NAN(const char*) BOOST_MATH_NOTHROW;
330 //extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_EXP2 (boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
331 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_LOG2(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
332 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_LOG1P(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
333 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_CBRT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
334 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_HYPOT(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
335 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ERF(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
336 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ERFC(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
337 extern "C" long long int BOOST_CSTDFLOAT_FLOAT128_LLROUND(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
338 extern "C" long int BOOST_CSTDFLOAT_FLOAT128_LROUND(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
339 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ROUND(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
340 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_NEARBYINT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
341 extern "C" long long int BOOST_CSTDFLOAT_FLOAT128_LLRINT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
342 extern "C" long int BOOST_CSTDFLOAT_FLOAT128_LRINT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
343 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_RINT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
344 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_MODF(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t*) BOOST_MATH_NOTHROW;
345 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SCALBLN(boost::math::cstdfloat::detail::float_internal128_t, long int) BOOST_MATH_NOTHROW;
346 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SCALBN(boost::math::cstdfloat::detail::float_internal128_t, int) BOOST_MATH_NOTHROW;
347 extern "C" int BOOST_CSTDFLOAT_FLOAT128_ILOGB(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
348 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_LOGB(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
349 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_NEXTAFTER(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
350 //extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_NEXTTOWARD (boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
351 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_COPYSIGN(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
352 extern "C" int BOOST_CSTDFLOAT_FLOAT128_SIGNBIT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
353 //extern "C" int BOOST_CSTDFLOAT_FLOAT128_FPCLASSIFY (boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
354 //extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISFINITE (boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
355 extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISINF(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
356 extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISNAN(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
357 //extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ISNORMAL (boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
358 //extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISGREATER (boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
359 //extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISGREATEREQUAL(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
360 //extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISLESS (boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
361 //extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISLESSEQUAL (boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
362 //extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISLESSGREATER(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
363 //extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISUNORDERED (boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;
364 // end more functions
365
366 #if !defined(BOOST_CSTDFLOAT_BROKEN_FLOAT128_MATH_FUNCTIONS)
367
368 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_EXP(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;
369 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_EXPM1(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;
370 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SINH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;
371 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_COSH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;
372 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_TANH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;
373 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ASINH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;
374 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ACOSH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;
375 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ATANH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;
376 extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_TGAMMA(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;
377
378 #else // BOOST_CSTDFLOAT_BROKEN_FLOAT128_MATH_FUNCTIONS
379
380 // Forward declaration of the patched exponent function, exp(x).
381 inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_EXP(boost::math::cstdfloat::detail::float_internal128_t x);
382
383 inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_EXPM1(boost::math::cstdfloat::detail::float_internal128_t x)
384 {
385 // Compute exp(x) - 1 for x small.
386
387 // Use an order-12 Pade approximation of the exponential function.
388 // PadeApproximant[Exp[x] - 1, {x, 0, 12, 12}].
389
390 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;
391
392 float_type sum;
393
394 if (x > BOOST_FLOAT128_C(0.693147180559945309417232121458176568075500134360255))
395 {
396 sum = ::BOOST_CSTDFLOAT_FLOAT128_EXP(x) - float_type(1);
397 }
398 else
399 {
400 const float_type x2 = (x * x);
401
402 const float_type top = ((((( float_type(BOOST_FLOAT128_C(2.4087176110456818621091195109360728010934088788572E-13)) * x2
403 + float_type(BOOST_FLOAT128_C(9.2735628025258751691201101171038802842096241836000E-10))) * x2
404 + float_type(BOOST_FLOAT128_C(9.0806726962333369656024118266681195742980640005812E-07))) * x2
405 + float_type(BOOST_FLOAT128_C(3.1055900621118012422360248447204968944099378881988E-04))) * x2
406 + float_type(BOOST_FLOAT128_C(3.6231884057971014492753623188405797101449275362319E-02))) * x2
407 + float_type(BOOST_FLOAT128_C(1.00000000000000000000000000000000000000000000000000000)))
408 ;
409
410 const float_type bot = (((((((((((( float_type(BOOST_FLOAT128_C(+7.7202487533515444298369215094104897470942592271063E-16)) * x
411 + float_type(BOOST_FLOAT128_C(-1.2043588055228409310545597554680364005467044394286E-13))) * x
412 + float_type(BOOST_FLOAT128_C(+9.2735628025258751691201101171038802842096241836000E-12))) * x
413 + float_type(BOOST_FLOAT128_C(-4.6367814012629375845600550585519401421048120918000E-10))) * x
414 + float_type(BOOST_FLOAT128_C(+1.6692413044546575304416198210786984511577323530480E-08))) * x
415 + float_type(BOOST_FLOAT128_C(-4.5403363481166684828012059133340597871490320002906E-07))) * x
416 + float_type(BOOST_FLOAT128_C(+9.5347063310450038138825324180015255530129672006102E-06))) * x
417 + float_type(BOOST_FLOAT128_C(-1.5527950310559006211180124223602484472049689440994E-04))) * x
418 + float_type(BOOST_FLOAT128_C(+1.9409937888198757763975155279503105590062111801242E-03))) * x
419 + float_type(BOOST_FLOAT128_C(-1.8115942028985507246376811594202898550724637681159E-02))) * x
420 + float_type(BOOST_FLOAT128_C(+1.1956521739130434782608695652173913043478260869565E-01))) * x
421 + float_type(BOOST_FLOAT128_C(-0.50000000000000000000000000000000000000000000000000000))) * x
422 + float_type(BOOST_FLOAT128_C(+1.00000000000000000000000000000000000000000000000000000)))
423 ;
424
425 sum = (x * top) / bot;
426 }
427
428 return sum;
429 }
430 inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_EXP(boost::math::cstdfloat::detail::float_internal128_t x)
431 {
432 // Patch the expq() function for a subset of broken GCC compilers
433 // like GCC 4.7, 4.8 on MinGW.
434
435 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;
436
437 // Scale the argument x to the range (-ln2 < x < ln2).
438 constexpr float_type one_over_ln2 = float_type(BOOST_FLOAT128_C(1.44269504088896340735992468100189213742664595415299));
439 const float_type x_over_ln2 = x * one_over_ln2;
440
441 int n;
442
443 if (x != x)
444 {
445 // The argument is NaN.
446 return std::numeric_limits<float_type>::quiet_NaN();
447 }
448 else if (::BOOST_CSTDFLOAT_FLOAT128_FABS(x) > BOOST_FLOAT128_C(+0.693147180559945309417232121458176568075500134360255))
449 {
450 // The absolute value of the argument exceeds ln2.
451 n = static_cast<int>(::BOOST_CSTDFLOAT_FLOAT128_FLOOR(x_over_ln2));
452 }
453 else if (::BOOST_CSTDFLOAT_FLOAT128_FABS(x) < BOOST_FLOAT128_C(+0.693147180559945309417232121458176568075500134360255))
454 {
455 // The absolute value of the argument is less than ln2.
456 n = 0;
457 }
458 else
459 {
460 // The absolute value of the argument is exactly equal to ln2 (in the sense of floating-point equality).
461 return float_type(2);
462 }
463
464 // Check if the argument is very near an integer.
465 const float_type floor_of_x = ::BOOST_CSTDFLOAT_FLOAT128_FLOOR(x);
466
467 if (::BOOST_CSTDFLOAT_FLOAT128_FABS(x - floor_of_x) < float_type(BOOST_CSTDFLOAT_FLOAT128_EPS))
468 {
469 // Return e^n for arguments very near an integer.
470 return boost::math::cstdfloat::detail::pown(BOOST_FLOAT128_C(2.71828182845904523536028747135266249775724709369996), static_cast<std::int_fast32_t>(floor_of_x));
471 }
472
473 // Compute the scaled argument alpha.
474 const float_type alpha = x - (n * BOOST_FLOAT128_C(0.693147180559945309417232121458176568075500134360255));
475
476 // Compute the polynomial approximation of expm1(alpha) and add to it
477 // in order to obtain the scaled result.
478 const float_type scaled_result = ::BOOST_CSTDFLOAT_FLOAT128_EXPM1(alpha) + float_type(1);
479
480 // Rescale the result and return it.
481 return scaled_result * boost::math::cstdfloat::detail::pown(float_type(2), n);
482 }
483 inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SINH(boost::math::cstdfloat::detail::float_internal128_t x)
484 {
485 // Patch the sinhq() function for a subset of broken GCC compilers
486 // like GCC 4.7, 4.8 on MinGW.
487 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;
488
489 // Here, we use the following:
490 // Set: ex = exp(x)
491 // Set: em1 = expm1(x)
492 // Then
493 // sinh(x) = (ex - 1/ex) / 2 ; for |x| >= 1
494 // sinh(x) = (2em1 + em1^2) / (2ex) ; for |x| < 1
495
496 const float_type ex = ::BOOST_CSTDFLOAT_FLOAT128_EXP(x);
497
498 if (::BOOST_CSTDFLOAT_FLOAT128_FABS(x) < float_type(+1))
499 {
500 const float_type em1 = ::BOOST_CSTDFLOAT_FLOAT128_EXPM1(x);
501
502 return ((em1 * 2) + (em1 * em1)) / (ex * 2);
503 }
504 else
505 {
506 return (ex - (float_type(1) / ex)) / 2;
507 }
508 }
509 inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_COSH(boost::math::cstdfloat::detail::float_internal128_t x)
510 {
511 // Patch the coshq() function for a subset of broken GCC compilers
512 // like GCC 4.7, 4.8 on MinGW.
513 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;
514 const float_type ex = ::BOOST_CSTDFLOAT_FLOAT128_EXP(x);
515 return (ex + (float_type(1) / ex)) / 2;
516 }
517 inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_TANH(boost::math::cstdfloat::detail::float_internal128_t x)
518 {
519 // Patch the tanhq() function for a subset of broken GCC compilers
520 // like GCC 4.7, 4.8 on MinGW.
521 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;
522 const float_type ex_plus = ::BOOST_CSTDFLOAT_FLOAT128_EXP(x);
523 const float_type ex_minus = (float_type(1) / ex_plus);
524 return (ex_plus - ex_minus) / (ex_plus + ex_minus);
525 }
526 inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ASINH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW
527 {
528 // Patch the asinh() function since quadmath does not have it.
529 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;
530 return ::BOOST_CSTDFLOAT_FLOAT128_LOG(x + ::BOOST_CSTDFLOAT_FLOAT128_SQRT((x * x) + float_type(1)));
531 }
532 inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ACOSH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW
533 {
534 // Patch the acosh() function since quadmath does not have it.
535 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;
536 const float_type zp(x + float_type(1));
537 const float_type zm(x - float_type(1));
538
539 return ::BOOST_CSTDFLOAT_FLOAT128_LOG(x + (zp * ::BOOST_CSTDFLOAT_FLOAT128_SQRT(zm / zp)));
540 }
541 inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ATANH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW
542 {
543 // Patch the atanh() function since quadmath does not have it.
544 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;
545 return (::BOOST_CSTDFLOAT_FLOAT128_LOG(float_type(1) + x)
546 - ::BOOST_CSTDFLOAT_FLOAT128_LOG(float_type(1) - x)) / 2;
547 }
548 inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_TGAMMA(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW
549 {
550 // Patch the tgammaq() function for a subset of broken GCC compilers
551 // like GCC 4.7, 4.8 on MinGW.
552 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;
553
554 if (x > float_type(0))
555 {
556 return ::BOOST_CSTDFLOAT_FLOAT128_EXP(::BOOST_CSTDFLOAT_FLOAT128_LGAMMA(x));
557 }
558 else if (x < float_type(0))
559 {
560 // For x < 0, compute tgamma(-x) and use the reflection formula.
561 const float_type positive_x = -x;
562 float_type gamma_value = ::BOOST_CSTDFLOAT_FLOAT128_TGAMMA(positive_x);
563 const float_type floor_of_positive_x = ::BOOST_CSTDFLOAT_FLOAT128_FLOOR(positive_x);
564
565 // Take the reflection checks (slightly adapted) from <boost/math/gamma.hpp>.
566 const bool floor_of_z_is_equal_to_z = (positive_x == ::BOOST_CSTDFLOAT_FLOAT128_FLOOR(positive_x));
567
568 constexpr float_type my_pi = BOOST_FLOAT128_C(3.14159265358979323846264338327950288419716939937511);
569
570 if (floor_of_z_is_equal_to_z)
571 {
572 const bool is_odd = ((std::int32_t(floor_of_positive_x) % std::int32_t(2)) != std::int32_t(0));
573
574 return (is_odd ? -std::numeric_limits<float_type>::infinity()
575 : +std::numeric_limits<float_type>::infinity());
576 }
577
578 const float_type sinpx_value = x * ::BOOST_CSTDFLOAT_FLOAT128_SIN(my_pi * x);
579
580 gamma_value *= sinpx_value;
581
582 const bool result_is_too_large_to_represent = ((::BOOST_CSTDFLOAT_FLOAT128_FABS(gamma_value) < float_type(1))
583 && (((std::numeric_limits<float_type>::max)() * ::BOOST_CSTDFLOAT_FLOAT128_FABS(gamma_value)) < my_pi));
584
585 if (result_is_too_large_to_represent)
586 {
587 const bool is_odd = ((std::int32_t(floor_of_positive_x) % std::int32_t(2)) != std::int32_t(0));
588
589 return (is_odd ? -std::numeric_limits<float_type>::infinity()
590 : +std::numeric_limits<float_type>::infinity());
591 }
592
593 gamma_value = -my_pi / gamma_value;
594
595 if ((gamma_value > float_type(0)) || (gamma_value < float_type(0)))
596 {
597 return gamma_value;
598 }
599 else
600 {
601 // The value of gamma is too small to represent. Return 0.0 here.
602 return float_type(0);
603 }
604 }
605 else
606 {
607 // Gamma of zero is complex infinity. Return NaN here.
608 return std::numeric_limits<float_type>::quiet_NaN();
609 }
610 }
611 #endif // BOOST_CSTDFLOAT_BROKEN_FLOAT128_MATH_FUNCTIONS
612
613 // Define the quadruple-precision <cmath> functions in the namespace boost::math::cstdfloat::detail.
614
615 namespace boost {
616 namespace math {
617 namespace cstdfloat {
618 namespace detail {
619 inline boost::math::cstdfloat::detail::float_internal128_t ldexp(boost::math::cstdfloat::detail::float_internal128_t x, int n) { return ::BOOST_CSTDFLOAT_FLOAT128_LDEXP(x, n); }
620 inline boost::math::cstdfloat::detail::float_internal128_t frexp(boost::math::cstdfloat::detail::float_internal128_t x, int* pn) { return ::BOOST_CSTDFLOAT_FLOAT128_FREXP(x, pn); }
621 inline boost::math::cstdfloat::detail::float_internal128_t fabs(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_FABS(x); }
622 inline boost::math::cstdfloat::detail::float_internal128_t abs(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_FABS(x); }
623 inline boost::math::cstdfloat::detail::float_internal128_t floor(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_FLOOR(x); }
624 inline boost::math::cstdfloat::detail::float_internal128_t ceil(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_CEIL(x); }
625 inline boost::math::cstdfloat::detail::float_internal128_t sqrt(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_SQRT(x); }
626 inline boost::math::cstdfloat::detail::float_internal128_t trunc(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_TRUNC(x); }
627 inline boost::math::cstdfloat::detail::float_internal128_t exp(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_EXP(x); }
628 inline boost::math::cstdfloat::detail::float_internal128_t expm1(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_EXPM1(x); }
629 inline boost::math::cstdfloat::detail::float_internal128_t pow(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t a) { return ::BOOST_CSTDFLOAT_FLOAT128_POW(x, a); }
630 inline boost::math::cstdfloat::detail::float_internal128_t pow(boost::math::cstdfloat::detail::float_internal128_t x, int a) { return ::BOOST_CSTDFLOAT_FLOAT128_POW(x, boost::math::cstdfloat::detail::float_internal128_t(a)); }
631 inline boost::math::cstdfloat::detail::float_internal128_t log(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LOG(x); }
632 inline boost::math::cstdfloat::detail::float_internal128_t log10(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LOG10(x); }
633 inline boost::math::cstdfloat::detail::float_internal128_t sin(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_SIN(x); }
634 inline boost::math::cstdfloat::detail::float_internal128_t cos(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_COS(x); }
635 inline boost::math::cstdfloat::detail::float_internal128_t tan(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_TAN(x); }
636 inline boost::math::cstdfloat::detail::float_internal128_t asin(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ASIN(x); }
637 inline boost::math::cstdfloat::detail::float_internal128_t acos(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ACOS(x); }
638 inline boost::math::cstdfloat::detail::float_internal128_t atan(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ATAN(x); }
639 inline boost::math::cstdfloat::detail::float_internal128_t sinh(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_SINH(x); }
640 inline boost::math::cstdfloat::detail::float_internal128_t cosh(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_COSH(x); }
641 inline boost::math::cstdfloat::detail::float_internal128_t tanh(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_TANH(x); }
642 inline boost::math::cstdfloat::detail::float_internal128_t asinh(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ASINH(x); }
643 inline boost::math::cstdfloat::detail::float_internal128_t acosh(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ACOSH(x); }
644 inline boost::math::cstdfloat::detail::float_internal128_t atanh(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ATANH(x); }
645 inline boost::math::cstdfloat::detail::float_internal128_t fmod(boost::math::cstdfloat::detail::float_internal128_t a, boost::math::cstdfloat::detail::float_internal128_t b) { return ::BOOST_CSTDFLOAT_FLOAT128_FMOD(a, b); }
646 inline boost::math::cstdfloat::detail::float_internal128_t atan2(boost::math::cstdfloat::detail::float_internal128_t y, boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ATAN2(y, x); }
647 inline boost::math::cstdfloat::detail::float_internal128_t lgamma(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LGAMMA(x); }
648 inline boost::math::cstdfloat::detail::float_internal128_t tgamma(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_TGAMMA(x); }
649 // begin more functions
650 inline boost::math::cstdfloat::detail::float_internal128_t remainder(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_REMAINDER(x, y); }
651 inline boost::math::cstdfloat::detail::float_internal128_t remquo(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y, int* z) { return ::BOOST_CSTDFLOAT_FLOAT128_REMQUO(x, y, z); }
652 inline boost::math::cstdfloat::detail::float_internal128_t fma(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y, boost::math::cstdfloat::detail::float_internal128_t z) { return BOOST_CSTDFLOAT_FLOAT128_FMA(x, y, z); }
653
654 inline boost::math::cstdfloat::detail::float_internal128_t fmax(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_FMAX(x, y); }
655 template <class T>
656 inline typename std::enable_if<
657 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
658 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
659 fmax(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return ::BOOST_CSTDFLOAT_FLOAT128_FMAX(x, y); }
660 template <class T>
661 inline typename std::enable_if<
662 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
663 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
664 fmax(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_FMAX(x, y); }
665 inline boost::math::cstdfloat::detail::float_internal128_t fmin(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_FMIN(x, y); }
666 template <class T>
667 inline typename std::enable_if<
668 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
669 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
670 fmin(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return ::BOOST_CSTDFLOAT_FLOAT128_FMIN(x, y); }
671 template <class T>
672 inline typename std::enable_if<
673 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
674 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
675 fmin(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_FMIN(x, y); }
676
677 inline boost::math::cstdfloat::detail::float_internal128_t fdim(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_FDIM(x, y); }
678 inline boost::math::cstdfloat::detail::float_internal128_t nanq(const char* x) { return ::BOOST_CSTDFLOAT_FLOAT128_NAN(x); }
679 inline boost::math::cstdfloat::detail::float_internal128_t exp2(boost::math::cstdfloat::detail::float_internal128_t x)
680 {
681 return ::BOOST_CSTDFLOAT_FLOAT128_POW(boost::math::cstdfloat::detail::float_internal128_t(2), x);
682 }
683 inline boost::math::cstdfloat::detail::float_internal128_t log2(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LOG2(x); }
684 inline boost::math::cstdfloat::detail::float_internal128_t log1p(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LOG1P(x); }
685 inline boost::math::cstdfloat::detail::float_internal128_t cbrt(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_CBRT(x); }
686 inline boost::math::cstdfloat::detail::float_internal128_t hypot(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y, boost::math::cstdfloat::detail::float_internal128_t z) { return ::BOOST_CSTDFLOAT_FLOAT128_SQRT(x*x + y * y + z * z); }
687 inline boost::math::cstdfloat::detail::float_internal128_t hypot(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_HYPOT(x, y); }
688 template <class T>
689 inline typename std::enable_if<
690 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
691 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
692 hypot(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return ::BOOST_CSTDFLOAT_FLOAT128_HYPOT(x, y); }
693 template <class T>
694 inline typename std::enable_if<
695 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
696 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
697 hypot(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_HYPOT(x, y); }
698
699
700 inline boost::math::cstdfloat::detail::float_internal128_t erf(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ERF(x); }
701 inline boost::math::cstdfloat::detail::float_internal128_t erfc(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ERFC(x); }
702 inline long long int llround(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LLROUND(x); }
703 inline long int lround(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LROUND(x); }
704 inline boost::math::cstdfloat::detail::float_internal128_t round(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ROUND(x); }
705 inline boost::math::cstdfloat::detail::float_internal128_t nearbyint(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_NEARBYINT(x); }
706 inline long long int llrint(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LLRINT(x); }
707 inline long int lrint(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LRINT(x); }
708 inline boost::math::cstdfloat::detail::float_internal128_t rint(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_RINT(x); }
709 inline boost::math::cstdfloat::detail::float_internal128_t modf(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t* y) { return ::BOOST_CSTDFLOAT_FLOAT128_MODF(x, y); }
710 inline boost::math::cstdfloat::detail::float_internal128_t scalbln(boost::math::cstdfloat::detail::float_internal128_t x, long int y) { return ::BOOST_CSTDFLOAT_FLOAT128_SCALBLN(x, y); }
711 inline boost::math::cstdfloat::detail::float_internal128_t scalbn(boost::math::cstdfloat::detail::float_internal128_t x, int y) { return ::BOOST_CSTDFLOAT_FLOAT128_SCALBN(x, y); }
712 inline int ilogb(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ILOGB(x); }
713 inline boost::math::cstdfloat::detail::float_internal128_t logb(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LOGB(x); }
714 inline boost::math::cstdfloat::detail::float_internal128_t nextafter(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_NEXTAFTER(x, y); }
715 inline boost::math::cstdfloat::detail::float_internal128_t nexttoward(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return -(::BOOST_CSTDFLOAT_FLOAT128_NEXTAFTER(-x, -y)); }
716 inline boost::math::cstdfloat::detail::float_internal128_t copysign BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_COPYSIGN(x, y); }
717 inline bool signbit BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_SIGNBIT(x); }
718 inline int fpclassify BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x)
719 {
720 if (::BOOST_CSTDFLOAT_FLOAT128_ISNAN(x))
721 return FP_NAN;
722 else if (::BOOST_CSTDFLOAT_FLOAT128_ISINF(x))
723 return FP_INFINITE;
724 else if (x == BOOST_FLOAT128_C(0.0))
725 return FP_ZERO;
726
727 if (::BOOST_CSTDFLOAT_FLOAT128_FABS(x) < BOOST_CSTDFLOAT_FLOAT128_MIN)
728 return FP_SUBNORMAL;
729 else
730 return FP_NORMAL;
731 }
732 inline bool isfinite BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x)
733 {
734 return !::BOOST_CSTDFLOAT_FLOAT128_ISNAN(x) && !::BOOST_CSTDFLOAT_FLOAT128_ISINF(x);
735 }
736 inline bool isinf BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ISINF(x); }
737 inline bool isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ISNAN(x); }
738 inline bool isnormal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return boost::math::cstdfloat::detail::fpclassify BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) == FP_NORMAL; }
739 inline bool isgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y)
740 {
741 if (isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(y))
742 return false;
743 return x > y;
744 }
745 template <class T>
746 inline typename std::enable_if<
747 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
748 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
749 isgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); }
750 template <class T>
751 inline typename std::enable_if<
752 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
753 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
754 isgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); }
755
756 inline bool isgreaterequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y)
757 {
758 if (isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(y))
759 return false;
760 return x >= y;
761 }
762 template <class T>
763 inline typename std::enable_if<
764 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
765 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
766 isgreaterequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isgreaterequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); }
767 template <class T>
768 inline typename std::enable_if<
769 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
770 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
771 isgreaterequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isgreaterequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); }
772
773 inline bool isless BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y)
774 {
775 if (isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(y))
776 return false;
777 return x < y;
778 }
779 template <class T>
780 inline typename std::enable_if<
781 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
782 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
783 isless BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isless BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); }
784 template <class T>
785 inline typename std::enable_if<
786 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
787 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
788 isless BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isless BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); }
789
790
791 inline bool islessequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y)
792 {
793 if (isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(y))
794 return false;
795 return x <= y;
796 }
797 template <class T>
798 inline typename std::enable_if<
799 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
800 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
801 islessequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return islessequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); }
802 template <class T>
803 inline typename std::enable_if<
804 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
805 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
806 islessequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return islessequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); }
807
808
809 inline bool islessgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y)
810 {
811 if (isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(y))
812 return false;
813 return (x < y) || (x > y);
814 }
815 template <class T>
816 inline typename std::enable_if<
817 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
818 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
819 islessgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return islessgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); }
820 template <class T>
821 inline typename std::enable_if<
822 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
823 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
824 islessgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return islessgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); }
825
826
827 inline bool isunordered BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_ISNAN(x) || ::BOOST_CSTDFLOAT_FLOAT128_ISNAN(y); }
828 template <class T>
829 inline typename std::enable_if<
830 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
831 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
832 isunordered BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isunordered BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); }
833 template <class T>
834 inline typename std::enable_if<
835 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value
836 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type
837 isunordered BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isunordered BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); }
838
839
840 // end more functions
841 }
842 }
843 }
844 } // boost::math::cstdfloat::detail
845
846 // We will now inject the quadruple-precision <cmath> functions
847 // into the std namespace. This is done via *using* directive.
848 namespace std
849 {
850 using boost::math::cstdfloat::detail::ldexp;
851 using boost::math::cstdfloat::detail::frexp;
852 using boost::math::cstdfloat::detail::fabs;
853
854 #if !(defined(_GLIBCXX_USE_FLOAT128) && defined(__GNUC__) && (__GNUC__ >= 7))
855 #if (defined(__clang__) && !(!defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128))) || (__GNUC__ <= 6 && !defined(__clang__))
856 // workaround for clang using libstdc++ and old GCC
857 using boost::math::cstdfloat::detail::abs;
858 #endif
859 #endif
860
861 using boost::math::cstdfloat::detail::floor;
862 using boost::math::cstdfloat::detail::ceil;
863 using boost::math::cstdfloat::detail::sqrt;
864 using boost::math::cstdfloat::detail::trunc;
865 using boost::math::cstdfloat::detail::exp;
866 using boost::math::cstdfloat::detail::expm1;
867 using boost::math::cstdfloat::detail::pow;
868 using boost::math::cstdfloat::detail::log;
869 using boost::math::cstdfloat::detail::log10;
870 using boost::math::cstdfloat::detail::sin;
871 using boost::math::cstdfloat::detail::cos;
872 using boost::math::cstdfloat::detail::tan;
873 using boost::math::cstdfloat::detail::asin;
874 using boost::math::cstdfloat::detail::acos;
875 using boost::math::cstdfloat::detail::atan;
876 using boost::math::cstdfloat::detail::sinh;
877 using boost::math::cstdfloat::detail::cosh;
878 using boost::math::cstdfloat::detail::tanh;
879 using boost::math::cstdfloat::detail::asinh;
880 using boost::math::cstdfloat::detail::acosh;
881 using boost::math::cstdfloat::detail::atanh;
882 using boost::math::cstdfloat::detail::fmod;
883 using boost::math::cstdfloat::detail::atan2;
884 using boost::math::cstdfloat::detail::lgamma;
885 using boost::math::cstdfloat::detail::tgamma;
886
887 // begin more functions
888 using boost::math::cstdfloat::detail::remainder;
889 using boost::math::cstdfloat::detail::remquo;
890 using boost::math::cstdfloat::detail::fma;
891 using boost::math::cstdfloat::detail::fmax;
892 using boost::math::cstdfloat::detail::fmin;
893 using boost::math::cstdfloat::detail::fdim;
894 using boost::math::cstdfloat::detail::nanq;
895 using boost::math::cstdfloat::detail::exp2;
896 using boost::math::cstdfloat::detail::log2;
897 using boost::math::cstdfloat::detail::log1p;
898 using boost::math::cstdfloat::detail::cbrt;
899 using boost::math::cstdfloat::detail::hypot;
900 using boost::math::cstdfloat::detail::erf;
901 using boost::math::cstdfloat::detail::erfc;
902 using boost::math::cstdfloat::detail::llround;
903 using boost::math::cstdfloat::detail::lround;
904 using boost::math::cstdfloat::detail::round;
905 using boost::math::cstdfloat::detail::nearbyint;
906 using boost::math::cstdfloat::detail::llrint;
907 using boost::math::cstdfloat::detail::lrint;
908 using boost::math::cstdfloat::detail::rint;
909 using boost::math::cstdfloat::detail::modf;
910 using boost::math::cstdfloat::detail::scalbln;
911 using boost::math::cstdfloat::detail::scalbn;
912 using boost::math::cstdfloat::detail::ilogb;
913 using boost::math::cstdfloat::detail::logb;
914 using boost::math::cstdfloat::detail::nextafter;
915 using boost::math::cstdfloat::detail::nexttoward;
916 using boost::math::cstdfloat::detail::copysign;
917 using boost::math::cstdfloat::detail::signbit;
918 using boost::math::cstdfloat::detail::fpclassify;
919 using boost::math::cstdfloat::detail::isfinite;
920 using boost::math::cstdfloat::detail::isinf;
921 using boost::math::cstdfloat::detail::isnan;
922 using boost::math::cstdfloat::detail::isnormal;
923 using boost::math::cstdfloat::detail::isgreater;
924 using boost::math::cstdfloat::detail::isgreaterequal;
925 using boost::math::cstdfloat::detail::isless;
926 using boost::math::cstdfloat::detail::islessequal;
927 using boost::math::cstdfloat::detail::islessgreater;
928 using boost::math::cstdfloat::detail::isunordered;
929 // end more functions
930
931 } // namespace std
932
933 // We will now remove the preprocessor symbols representing quadruple-precision <cmath>
934 // functions from the preprocessor.
935
936 #undef BOOST_CSTDFLOAT_FLOAT128_LDEXP
937 #undef BOOST_CSTDFLOAT_FLOAT128_FREXP
938 #undef BOOST_CSTDFLOAT_FLOAT128_FABS
939 #undef BOOST_CSTDFLOAT_FLOAT128_FLOOR
940 #undef BOOST_CSTDFLOAT_FLOAT128_CEIL
941 #undef BOOST_CSTDFLOAT_FLOAT128_SQRT
942 #undef BOOST_CSTDFLOAT_FLOAT128_TRUNC
943 #undef BOOST_CSTDFLOAT_FLOAT128_EXP
944 #undef BOOST_CSTDFLOAT_FLOAT128_EXPM1
945 #undef BOOST_CSTDFLOAT_FLOAT128_POW
946 #undef BOOST_CSTDFLOAT_FLOAT128_LOG
947 #undef BOOST_CSTDFLOAT_FLOAT128_LOG10
948 #undef BOOST_CSTDFLOAT_FLOAT128_SIN
949 #undef BOOST_CSTDFLOAT_FLOAT128_COS
950 #undef BOOST_CSTDFLOAT_FLOAT128_TAN
951 #undef BOOST_CSTDFLOAT_FLOAT128_ASIN
952 #undef BOOST_CSTDFLOAT_FLOAT128_ACOS
953 #undef BOOST_CSTDFLOAT_FLOAT128_ATAN
954 #undef BOOST_CSTDFLOAT_FLOAT128_SINH
955 #undef BOOST_CSTDFLOAT_FLOAT128_COSH
956 #undef BOOST_CSTDFLOAT_FLOAT128_TANH
957 #undef BOOST_CSTDFLOAT_FLOAT128_ASINH
958 #undef BOOST_CSTDFLOAT_FLOAT128_ACOSH
959 #undef BOOST_CSTDFLOAT_FLOAT128_ATANH
960 #undef BOOST_CSTDFLOAT_FLOAT128_FMOD
961 #undef BOOST_CSTDFLOAT_FLOAT128_ATAN2
962 #undef BOOST_CSTDFLOAT_FLOAT128_LGAMMA
963 #undef BOOST_CSTDFLOAT_FLOAT128_TGAMMA
964
965 // begin more functions
966 #undef BOOST_CSTDFLOAT_FLOAT128_REMAINDER
967 #undef BOOST_CSTDFLOAT_FLOAT128_REMQUO
968 #undef BOOST_CSTDFLOAT_FLOAT128_FMA
969 #undef BOOST_CSTDFLOAT_FLOAT128_FMAX
970 #undef BOOST_CSTDFLOAT_FLOAT128_FMIN
971 #undef BOOST_CSTDFLOAT_FLOAT128_FDIM
972 #undef BOOST_CSTDFLOAT_FLOAT128_NAN
973 #undef BOOST_CSTDFLOAT_FLOAT128_EXP2
974 #undef BOOST_CSTDFLOAT_FLOAT128_LOG2
975 #undef BOOST_CSTDFLOAT_FLOAT128_LOG1P
976 #undef BOOST_CSTDFLOAT_FLOAT128_CBRT
977 #undef BOOST_CSTDFLOAT_FLOAT128_HYPOT
978 #undef BOOST_CSTDFLOAT_FLOAT128_ERF
979 #undef BOOST_CSTDFLOAT_FLOAT128_ERFC
980 #undef BOOST_CSTDFLOAT_FLOAT128_LLROUND
981 #undef BOOST_CSTDFLOAT_FLOAT128_LROUND
982 #undef BOOST_CSTDFLOAT_FLOAT128_ROUND
983 #undef BOOST_CSTDFLOAT_FLOAT128_NEARBYINT
984 #undef BOOST_CSTDFLOAT_FLOAT128_LLRINT
985 #undef BOOST_CSTDFLOAT_FLOAT128_LRINT
986 #undef BOOST_CSTDFLOAT_FLOAT128_RINT
987 #undef BOOST_CSTDFLOAT_FLOAT128_MODF
988 #undef BOOST_CSTDFLOAT_FLOAT128_SCALBLN
989 #undef BOOST_CSTDFLOAT_FLOAT128_SCALBN
990 #undef BOOST_CSTDFLOAT_FLOAT128_ILOGB
991 #undef BOOST_CSTDFLOAT_FLOAT128_LOGB
992 #undef BOOST_CSTDFLOAT_FLOAT128_NEXTAFTER
993 #undef BOOST_CSTDFLOAT_FLOAT128_NEXTTOWARD
994 #undef BOOST_CSTDFLOAT_FLOAT128_COPYSIGN
995 #undef BOOST_CSTDFLOAT_FLOAT128_SIGNBIT
996 #undef BOOST_CSTDFLOAT_FLOAT128_FPCLASSIFY
997 #undef BOOST_CSTDFLOAT_FLOAT128_ISFINITE
998 #undef BOOST_CSTDFLOAT_FLOAT128_ISINF
999 #undef BOOST_CSTDFLOAT_FLOAT128_ISNAN
1000 #undef BOOST_CSTDFLOAT_FLOAT128_ISNORMAL
1001 #undef BOOST_CSTDFLOAT_FLOAT128_ISGREATER
1002 #undef BOOST_CSTDFLOAT_FLOAT128_ISGREATEREQUAL
1003 #undef BOOST_CSTDFLOAT_FLOAT128_ISLESS
1004 #undef BOOST_CSTDFLOAT_FLOAT128_ISLESSEQUAL
1005 #undef BOOST_CSTDFLOAT_FLOAT128_ISLESSGREATER
1006 #undef BOOST_CSTDFLOAT_FLOAT128_ISUNORDERED
1007 // end more functions
1008
1009 #endif // Not BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT (i.e., the user would like to have libquadmath support)
1010
1011 #endif // BOOST_MATH_CSTDFLOAT_CMATH_2014_02_15_HPP_
1012