Chris@16
|
1 // Copyright (c) 2006-7 John Maddock
|
Chris@16
|
2 // Use, modification and distribution are subject to the
|
Chris@16
|
3 // Boost Software License, Version 1.0. (See accompanying file
|
Chris@16
|
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
5
|
Chris@16
|
6 #ifndef BOOST_MATH_TOOLS_CONFIG_HPP
|
Chris@16
|
7 #define BOOST_MATH_TOOLS_CONFIG_HPP
|
Chris@16
|
8
|
Chris@16
|
9 #ifdef _MSC_VER
|
Chris@16
|
10 #pragma once
|
Chris@16
|
11 #endif
|
Chris@16
|
12
|
Chris@16
|
13 #include <boost/config.hpp>
|
Chris@16
|
14 #include <boost/cstdint.hpp> // for boost::uintmax_t
|
Chris@16
|
15 #include <boost/detail/workaround.hpp>
|
Chris@101
|
16 #include <boost/type_traits/is_integral.hpp>
|
Chris@16
|
17 #include <algorithm> // for min and max
|
Chris@16
|
18 #include <boost/config/no_tr1/cmath.hpp>
|
Chris@16
|
19 #include <climits>
|
Chris@16
|
20 #include <cfloat>
|
Chris@16
|
21 #if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
|
Chris@16
|
22 # include <math.h>
|
Chris@16
|
23 #endif
|
Chris@101
|
24 #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
Chris@101
|
25 # include <limits>
|
Chris@101
|
26 #endif
|
Chris@16
|
27
|
Chris@16
|
28 #include <boost/math/tools/user.hpp>
|
Chris@16
|
29
|
Chris@16
|
30 #if (defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__NetBSD__) \
|
Chris@16
|
31 || (defined(__hppa) && !defined(__OpenBSD__)) || (defined(__NO_LONG_DOUBLE_MATH) && (DBL_MANT_DIG != LDBL_MANT_DIG))) \
|
Chris@16
|
32 && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
|
Chris@16
|
33 # define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
Chris@16
|
34 #endif
|
Chris@16
|
35 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
|
Chris@16
|
36 //
|
Chris@16
|
37 // Borland post 5.8.2 uses Dinkumware's std C lib which
|
Chris@16
|
38 // doesn't have true long double precision. Earlier
|
Chris@16
|
39 // versions are problematic too:
|
Chris@16
|
40 //
|
Chris@16
|
41 # define BOOST_MATH_NO_REAL_CONCEPT_TESTS
|
Chris@16
|
42 # define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
Chris@16
|
43 # define BOOST_MATH_CONTROL_FP _control87(MCW_EM,MCW_EM)
|
Chris@16
|
44 # include <float.h>
|
Chris@16
|
45 #endif
|
Chris@16
|
46 #ifdef __IBMCPP__
|
Chris@16
|
47 //
|
Chris@16
|
48 // For reasons I don't unserstand, the tests with IMB's compiler all
|
Chris@16
|
49 // pass at long double precision, but fail with real_concept, those tests
|
Chris@16
|
50 // are disabled for now. (JM 2012).
|
Chris@16
|
51 # define BOOST_MATH_NO_REAL_CONCEPT_TESTS
|
Chris@16
|
52 #endif
|
Chris@101
|
53 #ifdef sun
|
Chris@101
|
54 // Any use of __float128 in program startup code causes a segfault (tested JM 2015, Solaris 11).
|
Chris@101
|
55 # define BOOST_MATH_DISABLE_FLOAT128
|
Chris@101
|
56 #endif
|
Chris@16
|
57 #if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106)) && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
|
Chris@16
|
58 //
|
Chris@16
|
59 // Darwin's rather strange "double double" is rather hard to
|
Chris@16
|
60 // support, it should be possible given enough effort though...
|
Chris@16
|
61 //
|
Chris@16
|
62 # define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
Chris@16
|
63 #endif
|
Chris@16
|
64 #if defined(unix) && defined(__INTEL_COMPILER) && (__INTEL_COMPILER <= 1000) && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
|
Chris@16
|
65 //
|
Chris@16
|
66 // Intel compiler prior to version 10 has sporadic problems
|
Chris@16
|
67 // calling the long double overloads of the std lib math functions:
|
Chris@16
|
68 // calling ::powl is OK, but std::pow(long double, long double)
|
Chris@16
|
69 // may segfault depending upon the value of the arguments passed
|
Chris@16
|
70 // and the specific Linux distribution.
|
Chris@16
|
71 //
|
Chris@16
|
72 // We'll be conservative and disable long double support for this compiler.
|
Chris@16
|
73 //
|
Chris@16
|
74 // Comment out this #define and try building the tests to determine whether
|
Chris@16
|
75 // your Intel compiler version has this issue or not.
|
Chris@16
|
76 //
|
Chris@16
|
77 # define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
|
Chris@16
|
78 #endif
|
Chris@16
|
79 #if defined(unix) && defined(__INTEL_COMPILER)
|
Chris@16
|
80 //
|
Chris@16
|
81 // Intel compiler has sporadic issues compiling std::fpclassify depending on
|
Chris@16
|
82 // the exact OS version used. Use our own code for this as we know it works
|
Chris@16
|
83 // well on Intel processors:
|
Chris@16
|
84 //
|
Chris@16
|
85 #define BOOST_MATH_DISABLE_STD_FPCLASSIFY
|
Chris@16
|
86 #endif
|
Chris@16
|
87
|
Chris@16
|
88 #if defined(BOOST_MSVC) && !defined(_WIN32_WCE)
|
Chris@16
|
89 // Better safe than sorry, our tests don't support hardware exceptions:
|
Chris@16
|
90 # define BOOST_MATH_CONTROL_FP _control87(MCW_EM,MCW_EM)
|
Chris@16
|
91 #endif
|
Chris@16
|
92
|
Chris@16
|
93 #ifdef __IBMCPP__
|
Chris@16
|
94 # define BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS
|
Chris@16
|
95 #endif
|
Chris@16
|
96
|
Chris@16
|
97 #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901))
|
Chris@16
|
98 # define BOOST_MATH_USE_C99
|
Chris@16
|
99 #endif
|
Chris@16
|
100
|
Chris@16
|
101 #if (defined(__hpux) && !defined(__hppa))
|
Chris@16
|
102 # define BOOST_MATH_USE_C99
|
Chris@16
|
103 #endif
|
Chris@16
|
104
|
Chris@16
|
105 #if defined(__GNUC__) && defined(_GLIBCXX_USE_C99)
|
Chris@16
|
106 # define BOOST_MATH_USE_C99
|
Chris@16
|
107 #endif
|
Chris@16
|
108
|
Chris@16
|
109 #if defined(_LIBCPP_VERSION) && !defined(_MSC_VER)
|
Chris@16
|
110 # define BOOST_MATH_USE_C99
|
Chris@16
|
111 #endif
|
Chris@16
|
112
|
Chris@16
|
113 #if defined(__CYGWIN__) || defined(__HP_aCC) || defined(BOOST_INTEL) \
|
Chris@16
|
114 || defined(BOOST_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) \
|
Chris@16
|
115 || (defined(__GNUC__) && !defined(BOOST_MATH_USE_C99))\
|
Chris@16
|
116 || defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
|
Chris@16
|
117 # define BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY
|
Chris@16
|
118 #endif
|
Chris@16
|
119
|
Chris@101
|
120 #if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590)
|
Chris@16
|
121
|
Chris@16
|
122 # include "boost/type.hpp"
|
Chris@16
|
123 # include "boost/non_type.hpp"
|
Chris@16
|
124
|
Chris@16
|
125 # define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t) boost::type<t>* = 0
|
Chris@16
|
126 # define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t) boost::type<t>*
|
Chris@16
|
127 # define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v) boost::non_type<t, v>* = 0
|
Chris@16
|
128 # define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) boost::non_type<t, v>*
|
Chris@16
|
129
|
Chris@16
|
130 # define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(t) \
|
Chris@16
|
131 , BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t)
|
Chris@16
|
132 # define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) \
|
Chris@16
|
133 , BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
|
Chris@16
|
134 # define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) \
|
Chris@16
|
135 , BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
|
Chris@16
|
136 # define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) \
|
Chris@16
|
137 , BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
|
Chris@16
|
138
|
Chris@16
|
139 #else
|
Chris@16
|
140
|
Chris@16
|
141 // no workaround needed: expand to nothing
|
Chris@16
|
142
|
Chris@16
|
143 # define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t)
|
Chris@16
|
144 # define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
|
Chris@16
|
145 # define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
|
Chris@16
|
146 # define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
|
Chris@16
|
147
|
Chris@16
|
148 # define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(t)
|
Chris@16
|
149 # define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
|
Chris@16
|
150 # define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
|
Chris@16
|
151 # define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
|
Chris@16
|
152
|
Chris@16
|
153
|
Chris@101
|
154 #endif // __SUNPRO_CC
|
Chris@16
|
155
|
Chris@16
|
156 #if (defined(__SUNPRO_CC) || defined(__hppa) || defined(__GNUC__)) && !defined(BOOST_MATH_SMALL_CONSTANT)
|
Chris@16
|
157 // Sun's compiler emits a hard error if a constant underflows,
|
Chris@16
|
158 // as does aCC on PA-RISC, while gcc issues a large number of warnings:
|
Chris@101
|
159 # define BOOST_MATH_SMALL_CONSTANT(x) 0.0
|
Chris@16
|
160 #else
|
Chris@16
|
161 # define BOOST_MATH_SMALL_CONSTANT(x) x
|
Chris@16
|
162 #endif
|
Chris@16
|
163
|
Chris@16
|
164
|
Chris@16
|
165 #if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
|
Chris@16
|
166 //
|
Chris@16
|
167 // Define if constants too large for a float cause "bad"
|
Chris@16
|
168 // values to be stored in the data, rather than infinity
|
Chris@16
|
169 // or a suitably large value.
|
Chris@16
|
170 //
|
Chris@16
|
171 # define BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
|
Chris@16
|
172 #endif
|
Chris@16
|
173 //
|
Chris@16
|
174 // Tune performance options for specific compilers:
|
Chris@16
|
175 //
|
Chris@16
|
176 #ifdef BOOST_MSVC
|
Chris@16
|
177 # define BOOST_MATH_POLY_METHOD 2
|
Chris@16
|
178 #elif defined(BOOST_INTEL)
|
Chris@16
|
179 # define BOOST_MATH_POLY_METHOD 2
|
Chris@16
|
180 # define BOOST_MATH_RATIONAL_METHOD 2
|
Chris@16
|
181 #elif defined(__GNUC__)
|
Chris@16
|
182 # define BOOST_MATH_POLY_METHOD 3
|
Chris@16
|
183 # define BOOST_MATH_RATIONAL_METHOD 3
|
Chris@16
|
184 # define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT
|
Chris@16
|
185 # define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L
|
Chris@16
|
186 #endif
|
Chris@16
|
187
|
Chris@16
|
188 #if defined(BOOST_NO_LONG_LONG) && !defined(BOOST_MATH_INT_TABLE_TYPE)
|
Chris@16
|
189 # define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT
|
Chris@16
|
190 # define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L
|
Chris@16
|
191 #endif
|
Chris@16
|
192
|
Chris@16
|
193 //
|
Chris@16
|
194 // The maximum order of polynomial that will be evaluated
|
Chris@16
|
195 // via an unrolled specialisation:
|
Chris@16
|
196 //
|
Chris@16
|
197 #ifndef BOOST_MATH_MAX_POLY_ORDER
|
Chris@16
|
198 # define BOOST_MATH_MAX_POLY_ORDER 17
|
Chris@16
|
199 #endif
|
Chris@16
|
200 //
|
Chris@16
|
201 // Set the method used to evaluate polynomials and rationals:
|
Chris@16
|
202 //
|
Chris@16
|
203 #ifndef BOOST_MATH_POLY_METHOD
|
Chris@16
|
204 # define BOOST_MATH_POLY_METHOD 1
|
Chris@16
|
205 #endif
|
Chris@16
|
206 #ifndef BOOST_MATH_RATIONAL_METHOD
|
Chris@16
|
207 # define BOOST_MATH_RATIONAL_METHOD 0
|
Chris@16
|
208 #endif
|
Chris@16
|
209 //
|
Chris@16
|
210 // decide whether to store constants as integers or reals:
|
Chris@16
|
211 //
|
Chris@16
|
212 #ifndef BOOST_MATH_INT_TABLE_TYPE
|
Chris@16
|
213 # define BOOST_MATH_INT_TABLE_TYPE(RT, IT) IT
|
Chris@16
|
214 #endif
|
Chris@16
|
215 #ifndef BOOST_MATH_INT_VALUE_SUFFIX
|
Chris@16
|
216 # define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##SUF
|
Chris@16
|
217 #endif
|
Chris@16
|
218 //
|
Chris@16
|
219 // Test whether to support __float128:
|
Chris@16
|
220 //
|
Chris@101
|
221 #if defined(_GLIBCXX_USE_FLOAT128) && defined(BOOST_GCC) && !defined(__STRICT_ANSI__) \
|
Chris@101
|
222 && !defined(BOOST_MATH_DISABLE_FLOAT128) || defined(BOOST_MATH_USE_FLOAT128)
|
Chris@16
|
223 //
|
Chris@16
|
224 // Only enable this when the compiler really is GCC as clang and probably
|
Chris@16
|
225 // intel too don't support __float128 yet :-(
|
Chris@16
|
226 //
|
Chris@101
|
227 #ifndef BOOST_MATH_USE_FLOAT128
|
Chris@16
|
228 # define BOOST_MATH_USE_FLOAT128
|
Chris@16
|
229 #endif
|
Chris@101
|
230
|
Chris@101
|
231 # if defined(BOOST_INTEL) && defined(BOOST_INTEL_CXX_VERSION) && (BOOST_INTEL_CXX_VERSION >= 1310) && defined(__GNUC__)
|
Chris@101
|
232 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))
|
Chris@101
|
233 # define BOOST_MATH_FLOAT128_TYPE __float128
|
Chris@101
|
234 # endif
|
Chris@101
|
235 # elif defined(__GNUC__)
|
Chris@101
|
236 # define BOOST_MATH_FLOAT128_TYPE __float128
|
Chris@101
|
237 # endif
|
Chris@101
|
238
|
Chris@101
|
239 # ifndef BOOST_MATH_FLOAT128_TYPE
|
Chris@101
|
240 # define BOOST_MATH_FLOAT128_TYPE _Quad
|
Chris@101
|
241 # endif
|
Chris@101
|
242 #endif
|
Chris@16
|
243 //
|
Chris@16
|
244 // Check for WinCE with no iostream support:
|
Chris@16
|
245 //
|
Chris@16
|
246 #if defined(_WIN32_WCE) && !defined(__SGI_STL_PORT)
|
Chris@16
|
247 # define BOOST_MATH_NO_LEXICAL_CAST
|
Chris@16
|
248 #endif
|
Chris@16
|
249
|
Chris@16
|
250 //
|
Chris@16
|
251 // Helper macro for controlling the FP behaviour:
|
Chris@16
|
252 //
|
Chris@16
|
253 #ifndef BOOST_MATH_CONTROL_FP
|
Chris@16
|
254 # define BOOST_MATH_CONTROL_FP
|
Chris@16
|
255 #endif
|
Chris@16
|
256 //
|
Chris@16
|
257 // Helper macro for using statements:
|
Chris@16
|
258 //
|
Chris@16
|
259 #define BOOST_MATH_STD_USING_CORE \
|
Chris@16
|
260 using std::abs;\
|
Chris@16
|
261 using std::acos;\
|
Chris@16
|
262 using std::cos;\
|
Chris@16
|
263 using std::fmod;\
|
Chris@16
|
264 using std::modf;\
|
Chris@16
|
265 using std::tan;\
|
Chris@16
|
266 using std::asin;\
|
Chris@16
|
267 using std::cosh;\
|
Chris@16
|
268 using std::frexp;\
|
Chris@16
|
269 using std::pow;\
|
Chris@16
|
270 using std::tanh;\
|
Chris@16
|
271 using std::atan;\
|
Chris@16
|
272 using std::exp;\
|
Chris@16
|
273 using std::ldexp;\
|
Chris@16
|
274 using std::sin;\
|
Chris@16
|
275 using std::atan2;\
|
Chris@16
|
276 using std::fabs;\
|
Chris@16
|
277 using std::log;\
|
Chris@16
|
278 using std::sinh;\
|
Chris@16
|
279 using std::ceil;\
|
Chris@16
|
280 using std::floor;\
|
Chris@16
|
281 using std::log10;\
|
Chris@16
|
282 using std::sqrt;
|
Chris@16
|
283
|
Chris@16
|
284 #define BOOST_MATH_STD_USING BOOST_MATH_STD_USING_CORE
|
Chris@16
|
285
|
Chris@16
|
286 namespace boost{ namespace math{
|
Chris@16
|
287 namespace tools
|
Chris@16
|
288 {
|
Chris@16
|
289
|
Chris@16
|
290 template <class T>
|
Chris@16
|
291 inline T max BOOST_PREVENT_MACRO_SUBSTITUTION(T a, T b, T c)
|
Chris@16
|
292 {
|
Chris@16
|
293 return (std::max)((std::max)(a, b), c);
|
Chris@16
|
294 }
|
Chris@16
|
295
|
Chris@16
|
296 template <class T>
|
Chris@16
|
297 inline T max BOOST_PREVENT_MACRO_SUBSTITUTION(T a, T b, T c, T d)
|
Chris@16
|
298 {
|
Chris@16
|
299 return (std::max)((std::max)(a, b), (std::max)(c, d));
|
Chris@16
|
300 }
|
Chris@16
|
301
|
Chris@16
|
302 } // namespace tools
|
Chris@16
|
303
|
Chris@16
|
304 template <class T>
|
Chris@16
|
305 void suppress_unused_variable_warning(const T&)
|
Chris@16
|
306 {
|
Chris@16
|
307 }
|
Chris@16
|
308
|
Chris@101
|
309 namespace detail{
|
Chris@101
|
310
|
Chris@101
|
311 template <class T>
|
Chris@101
|
312 struct is_integer_for_rounding
|
Chris@101
|
313 {
|
Chris@101
|
314 static const bool value = boost::is_integral<T>::value
|
Chris@101
|
315 #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
Chris@101
|
316 || (std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::is_integer)
|
Chris@101
|
317 #endif
|
Chris@101
|
318 ;
|
Chris@101
|
319 };
|
Chris@101
|
320
|
Chris@101
|
321 }
|
Chris@101
|
322
|
Chris@16
|
323 }} // namespace boost namespace math
|
Chris@16
|
324
|
Chris@101
|
325 #ifdef __GLIBC_PREREQ
|
Chris@101
|
326 # if __GLIBC_PREREQ(2,14)
|
Chris@101
|
327 # define BOOST_MATH_HAVE_FIXED_GLIBC
|
Chris@101
|
328 # endif
|
Chris@101
|
329 #endif
|
Chris@101
|
330
|
Chris@101
|
331 #if ((defined(__linux__) && !defined(__UCLIBC__) && !defined(BOOST_MATH_HAVE_FIXED_GLIBC)) || defined(__QNX__) || defined(__IBMCPP__)) && !defined(BOOST_NO_FENV_H)
|
Chris@101
|
332 //
|
Chris@101
|
333 // This code was introduced in response to this glibc bug: http://sourceware.org/bugzilla/show_bug.cgi?id=2445
|
Chris@101
|
334 // Basically powl and expl can return garbage when the result is small and certain exception flags are set
|
Chris@101
|
335 // on entrance to these functions. This appears to have been fixed in Glibc 2.14 (May 2011).
|
Chris@101
|
336 // Much more information in this message thread: https://groups.google.com/forum/#!topic/boost-list/ZT99wtIFlb4
|
Chris@101
|
337 //
|
Chris@16
|
338
|
Chris@16
|
339 #include <boost/detail/fenv.hpp>
|
Chris@16
|
340
|
Chris@16
|
341 # ifdef FE_ALL_EXCEPT
|
Chris@16
|
342
|
Chris@16
|
343 namespace boost{ namespace math{
|
Chris@16
|
344 namespace detail
|
Chris@16
|
345 {
|
Chris@16
|
346 struct fpu_guard
|
Chris@16
|
347 {
|
Chris@16
|
348 fpu_guard()
|
Chris@16
|
349 {
|
Chris@16
|
350 fegetexceptflag(&m_flags, FE_ALL_EXCEPT);
|
Chris@16
|
351 feclearexcept(FE_ALL_EXCEPT);
|
Chris@16
|
352 }
|
Chris@16
|
353 ~fpu_guard()
|
Chris@16
|
354 {
|
Chris@16
|
355 fesetexceptflag(&m_flags, FE_ALL_EXCEPT);
|
Chris@16
|
356 }
|
Chris@16
|
357 private:
|
Chris@16
|
358 fexcept_t m_flags;
|
Chris@16
|
359 };
|
Chris@16
|
360
|
Chris@16
|
361 } // namespace detail
|
Chris@16
|
362 }} // namespaces
|
Chris@16
|
363
|
Chris@16
|
364 # define BOOST_FPU_EXCEPTION_GUARD boost::math::detail::fpu_guard local_guard_object;
|
Chris@16
|
365 # define BOOST_MATH_INSTRUMENT_FPU do{ fexcept_t cpu_flags; fegetexceptflag(&cpu_flags, FE_ALL_EXCEPT); BOOST_MATH_INSTRUMENT_VARIABLE(cpu_flags); } while(0);
|
Chris@16
|
366
|
Chris@16
|
367 # else
|
Chris@16
|
368
|
Chris@16
|
369 # define BOOST_FPU_EXCEPTION_GUARD
|
Chris@16
|
370 # define BOOST_MATH_INSTRUMENT_FPU
|
Chris@16
|
371
|
Chris@16
|
372 # endif
|
Chris@16
|
373
|
Chris@16
|
374 #else // All other platforms.
|
Chris@16
|
375 # define BOOST_FPU_EXCEPTION_GUARD
|
Chris@16
|
376 # define BOOST_MATH_INSTRUMENT_FPU
|
Chris@16
|
377 #endif
|
Chris@16
|
378
|
Chris@16
|
379 #ifdef BOOST_MATH_INSTRUMENT
|
Chris@16
|
380
|
Chris@16
|
381 # include <iostream>
|
Chris@16
|
382 # include <iomanip>
|
Chris@16
|
383 # include <typeinfo>
|
Chris@16
|
384
|
Chris@16
|
385 # define BOOST_MATH_INSTRUMENT_CODE(x) \
|
Chris@16
|
386 std::cout << std::setprecision(35) << __FILE__ << ":" << __LINE__ << " " << x << std::endl;
|
Chris@16
|
387 # define BOOST_MATH_INSTRUMENT_VARIABLE(name) BOOST_MATH_INSTRUMENT_CODE(BOOST_STRINGIZE(name) << " = " << name)
|
Chris@16
|
388
|
Chris@16
|
389 #else
|
Chris@16
|
390
|
Chris@16
|
391 # define BOOST_MATH_INSTRUMENT_CODE(x)
|
Chris@16
|
392 # define BOOST_MATH_INSTRUMENT_VARIABLE(name)
|
Chris@16
|
393
|
Chris@16
|
394 #endif
|
Chris@16
|
395
|
Chris@16
|
396 #endif // BOOST_MATH_TOOLS_CONFIG_HPP
|
Chris@16
|
397
|
Chris@16
|
398
|
Chris@16
|
399
|
Chris@16
|
400
|
Chris@16
|
401
|