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