Chris@16
|
1 /* Boost interval/hw_rounding.hpp template implementation file
|
Chris@16
|
2 *
|
Chris@16
|
3 * Copyright 2002 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion
|
Chris@16
|
4 * Copyright 2005 Guillaume Melquiond
|
Chris@16
|
5 *
|
Chris@16
|
6 * Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
7 * (See accompanying file LICENSE_1_0.txt or
|
Chris@16
|
8 * copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
9 */
|
Chris@16
|
10
|
Chris@16
|
11 #ifndef BOOST_NUMERIC_INTERVAL_HW_ROUNDING_HPP
|
Chris@16
|
12 #define BOOST_NUMERIC_INTERVAL_HW_ROUNDING_HPP
|
Chris@16
|
13
|
Chris@16
|
14 #include <boost/numeric/interval/rounding.hpp>
|
Chris@16
|
15 #include <boost/numeric/interval/rounded_arith.hpp>
|
Chris@16
|
16
|
Chris@16
|
17 #define BOOST_NUMERIC_INTERVAL_NO_HARDWARE
|
Chris@16
|
18
|
Chris@16
|
19 // define appropriate specialization of rounding_control for built-in types
|
Chris@16
|
20 #if defined(__x86_64__) && (defined(__USE_ISOC99) || defined(__APPLE__))
|
Chris@16
|
21 # include <boost/numeric/interval/detail/c99_rounding_control.hpp>
|
Chris@16
|
22 #elif defined(__i386__) || defined(_M_IX86) || defined(__BORLANDC__) || defined(_M_X64)
|
Chris@16
|
23 # include <boost/numeric/interval/detail/x86_rounding_control.hpp>
|
Chris@16
|
24 #elif defined(powerpc) || defined(__powerpc__) || defined(__ppc__)
|
Chris@16
|
25 # include <boost/numeric/interval/detail/ppc_rounding_control.hpp>
|
Chris@16
|
26 #elif defined(sparc) || defined(__sparc__)
|
Chris@16
|
27 # include <boost/numeric/interval/detail/sparc_rounding_control.hpp>
|
Chris@16
|
28 #elif defined(alpha) || defined(__alpha__)
|
Chris@16
|
29 # include <boost/numeric/interval/detail/alpha_rounding_control.hpp>
|
Chris@16
|
30 #elif defined(ia64) || defined(__ia64) || defined(__ia64__)
|
Chris@16
|
31 # include <boost/numeric/interval/detail/ia64_rounding_control.hpp>
|
Chris@16
|
32 #endif
|
Chris@16
|
33
|
Chris@16
|
34 #if defined(BOOST_NUMERIC_INTERVAL_NO_HARDWARE) && (defined(__USE_ISOC99) || defined(__MSL__))
|
Chris@16
|
35 # include <boost/numeric/interval/detail/c99_rounding_control.hpp>
|
Chris@16
|
36 #endif
|
Chris@16
|
37
|
Chris@16
|
38 #if defined(BOOST_NUMERIC_INTERVAL_NO_HARDWARE)
|
Chris@16
|
39 # undef BOOST_NUMERIC_INTERVAL_NO_HARDWARE
|
Chris@16
|
40 # error Boost.Numeric.Interval: Please specify rounding control mechanism.
|
Chris@16
|
41 #endif
|
Chris@16
|
42
|
Chris@16
|
43 namespace boost {
|
Chris@16
|
44 namespace numeric {
|
Chris@16
|
45 namespace interval_lib {
|
Chris@16
|
46
|
Chris@16
|
47 /*
|
Chris@16
|
48 * Three specializations of rounded_math<T>
|
Chris@16
|
49 */
|
Chris@16
|
50
|
Chris@16
|
51 template<>
|
Chris@16
|
52 struct rounded_math<float>
|
Chris@16
|
53 : save_state<rounded_arith_opp<float> >
|
Chris@16
|
54 {};
|
Chris@16
|
55
|
Chris@16
|
56 template<>
|
Chris@16
|
57 struct rounded_math<double>
|
Chris@16
|
58 : save_state<rounded_arith_opp<double> >
|
Chris@16
|
59 {};
|
Chris@16
|
60
|
Chris@16
|
61 template<>
|
Chris@16
|
62 struct rounded_math<long double>
|
Chris@16
|
63 : save_state<rounded_arith_opp<long double> >
|
Chris@16
|
64 {};
|
Chris@16
|
65
|
Chris@16
|
66 } // namespace interval_lib
|
Chris@16
|
67 } // namespace numeric
|
Chris@16
|
68 } // namespace boost
|
Chris@16
|
69
|
Chris@16
|
70 #endif // BOOST_NUMERIC_INTERVAL_HW_ROUNDING_HPP
|