File indexing completed on 2025-01-30 09:49:07
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_NUMERIC_INTERVAL_ROUNDING_HPP
0011 #define BOOST_NUMERIC_INTERVAL_ROUNDING_HPP
0012
0013 namespace boost {
0014 namespace numeric {
0015 namespace interval_lib {
0016
0017
0018
0019
0020
0021 template<class T>
0022 struct rounding_control
0023 {
0024 typedef int rounding_mode;
0025 static void get_rounding_mode(rounding_mode&) {}
0026 static void set_rounding_mode(rounding_mode) {}
0027 static void upward() {}
0028 static void downward() {}
0029 static void to_nearest() {}
0030 static const T& to_int(const T& x) { return x; }
0031 static const T& force_rounding(const T& x) { return x; }
0032 };
0033
0034
0035
0036
0037
0038
0039
0040 template<class T, class Rounding = rounding_control<T> >
0041 struct rounded_arith_exact;
0042
0043 template<class T, class Rounding = rounding_control<T> >
0044 struct rounded_arith_std;
0045
0046 template<class T, class Rounding = rounding_control<T> >
0047 struct rounded_arith_opp;
0048
0049 template<class T, class Rounding>
0050 struct rounded_transc_dummy;
0051
0052 template<class T, class Rounding = rounded_arith_exact<T> >
0053 struct rounded_transc_exact;
0054
0055 template<class T, class Rounding = rounded_arith_std<T> >
0056 struct rounded_transc_std;
0057
0058 template<class T, class Rounding = rounded_arith_opp<T> >
0059 struct rounded_transc_opp;
0060
0061
0062
0063
0064
0065 namespace detail {
0066
0067 template<class Rounding>
0068 struct save_state_unprotected: Rounding
0069 {
0070 typedef save_state_unprotected<Rounding> unprotected_rounding;
0071 };
0072
0073 }
0074
0075 template<class Rounding>
0076 struct save_state: Rounding
0077 {
0078 typename Rounding::rounding_mode mode;
0079 save_state() {
0080 this->get_rounding_mode(mode);
0081 this->init();
0082 }
0083 ~save_state() { this->set_rounding_mode(mode); }
0084 typedef detail::save_state_unprotected<Rounding> unprotected_rounding;
0085 };
0086
0087 template<class Rounding>
0088 struct save_state_nothing: Rounding
0089 {
0090 typedef save_state_nothing<Rounding> unprotected_rounding;
0091 };
0092
0093 template<class T>
0094 struct rounded_math: save_state_nothing<rounded_arith_exact<T> >
0095 {};
0096
0097 }
0098 }
0099 }
0100
0101 #endif