File indexing completed on 2025-01-30 09:49:07
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_NUMERIC_INTERVAL_ROUNDED_TRANSC_HPP
0011 #define BOOST_NUMERIC_INTERVAL_ROUNDED_TRANSC_HPP
0012
0013 #include <boost/numeric/interval/rounding.hpp>
0014 #include <boost/numeric/interval/detail/bugs.hpp>
0015 #include <boost/config/no_tr1/cmath.hpp>
0016
0017 namespace boost {
0018 namespace numeric {
0019 namespace interval_lib {
0020
0021 template<class T, class Rounding>
0022 struct rounded_transc_exact: Rounding
0023 {
0024 # define BOOST_NUMERIC_INTERVAL_new_func(f) \
0025 T f##_down(const T& x) { BOOST_NUMERIC_INTERVAL_using_math(f); return f(x); } \
0026 T f##_up (const T& x) { BOOST_NUMERIC_INTERVAL_using_math(f); return f(x); }
0027 BOOST_NUMERIC_INTERVAL_new_func(exp)
0028 BOOST_NUMERIC_INTERVAL_new_func(log)
0029 BOOST_NUMERIC_INTERVAL_new_func(sin)
0030 BOOST_NUMERIC_INTERVAL_new_func(cos)
0031 BOOST_NUMERIC_INTERVAL_new_func(tan)
0032 BOOST_NUMERIC_INTERVAL_new_func(asin)
0033 BOOST_NUMERIC_INTERVAL_new_func(acos)
0034 BOOST_NUMERIC_INTERVAL_new_func(atan)
0035 BOOST_NUMERIC_INTERVAL_new_func(sinh)
0036 BOOST_NUMERIC_INTERVAL_new_func(cosh)
0037 BOOST_NUMERIC_INTERVAL_new_func(tanh)
0038 # undef BOOST_NUMERIC_INTERVAL_new_func
0039 # define BOOST_NUMERIC_INTERVAL_new_func(f) \
0040 T f##_down(const T& x) { BOOST_NUMERIC_INTERVAL_using_ahyp(f); return f(x); } \
0041 T f##_up (const T& x) { BOOST_NUMERIC_INTERVAL_using_ahyp(f); return f(x); }
0042 BOOST_NUMERIC_INTERVAL_new_func(asinh)
0043 BOOST_NUMERIC_INTERVAL_new_func(acosh)
0044 BOOST_NUMERIC_INTERVAL_new_func(atanh)
0045 # undef BOOST_NUMERIC_INTERVAL_new_func
0046 };
0047
0048 template<class T, class Rounding>
0049 struct rounded_transc_std: Rounding
0050 {
0051 # define BOOST_NUMERIC_INTERVAL_new_func(f) \
0052 T f##_down(const T& x) \
0053 { BOOST_NUMERIC_INTERVAL_using_math(f); \
0054 this->downward(); return this->force_rounding(f(x)); } \
0055 T f##_up (const T& x) \
0056 { BOOST_NUMERIC_INTERVAL_using_math(f); \
0057 this->upward(); return this->force_rounding(f(x)); }
0058 BOOST_NUMERIC_INTERVAL_new_func(exp)
0059 BOOST_NUMERIC_INTERVAL_new_func(log)
0060 BOOST_NUMERIC_INTERVAL_new_func(sin)
0061 BOOST_NUMERIC_INTERVAL_new_func(cos)
0062 BOOST_NUMERIC_INTERVAL_new_func(tan)
0063 BOOST_NUMERIC_INTERVAL_new_func(asin)
0064 BOOST_NUMERIC_INTERVAL_new_func(acos)
0065 BOOST_NUMERIC_INTERVAL_new_func(atan)
0066 BOOST_NUMERIC_INTERVAL_new_func(sinh)
0067 BOOST_NUMERIC_INTERVAL_new_func(cosh)
0068 BOOST_NUMERIC_INTERVAL_new_func(tanh)
0069 # undef BOOST_NUMERIC_INTERVAL_new_func
0070 # define BOOST_NUMERIC_INTERVAL_new_func(f) \
0071 T f##_down(const T& x) \
0072 { BOOST_NUMERIC_INTERVAL_using_ahyp(f); \
0073 this->downward(); return this->force_rounding(f(x)); } \
0074 T f##_up (const T& x) \
0075 { BOOST_NUMERIC_INTERVAL_using_ahyp(f); \
0076 this->upward(); return this->force_rounding(f(x)); }
0077 BOOST_NUMERIC_INTERVAL_new_func(asinh)
0078 BOOST_NUMERIC_INTERVAL_new_func(acosh)
0079 BOOST_NUMERIC_INTERVAL_new_func(atanh)
0080 # undef BOOST_NUMERIC_INTERVAL_new_func
0081 };
0082
0083 template<class T, class Rounding>
0084 struct rounded_transc_opp: Rounding
0085 {
0086 # define BOOST_NUMERIC_INTERVAL_new_func(f) \
0087 T f##_down(const T& x) \
0088 { BOOST_NUMERIC_INTERVAL_using_math(f); \
0089 this->downward(); T y = this->force_rounding(f(x)); \
0090 this->upward(); return y; } \
0091 T f##_up (const T& x) \
0092 { BOOST_NUMERIC_INTERVAL_using_math(f); \
0093 return this->force_rounding(f(x)); }
0094 BOOST_NUMERIC_INTERVAL_new_func(exp)
0095 BOOST_NUMERIC_INTERVAL_new_func(log)
0096 BOOST_NUMERIC_INTERVAL_new_func(cos)
0097 BOOST_NUMERIC_INTERVAL_new_func(acos)
0098 BOOST_NUMERIC_INTERVAL_new_func(cosh)
0099 # undef BOOST_NUMERIC_INTERVAL_new_func
0100 # define BOOST_NUMERIC_INTERVAL_new_func(f) \
0101 T f##_down(const T& x) \
0102 { BOOST_NUMERIC_INTERVAL_using_math(f); \
0103 return -this->force_rounding(-f(x)); } \
0104 T f##_up (const T& x) \
0105 { BOOST_NUMERIC_INTERVAL_using_math(f); \
0106 return this->force_rounding(f(x)); }
0107 BOOST_NUMERIC_INTERVAL_new_func(sin)
0108 BOOST_NUMERIC_INTERVAL_new_func(tan)
0109 BOOST_NUMERIC_INTERVAL_new_func(asin)
0110 BOOST_NUMERIC_INTERVAL_new_func(atan)
0111 BOOST_NUMERIC_INTERVAL_new_func(sinh)
0112 BOOST_NUMERIC_INTERVAL_new_func(tanh)
0113 # undef BOOST_NUMERIC_INTERVAL_new_func
0114 # define BOOST_NUMERIC_INTERVAL_new_func(f) \
0115 T f##_down(const T& x) \
0116 { BOOST_NUMERIC_INTERVAL_using_ahyp(f); \
0117 this->downward(); T y = this->force_rounding(f(x)); \
0118 this->upward(); return y; } \
0119 T f##_up (const T& x) \
0120 { BOOST_NUMERIC_INTERVAL_using_ahyp(f); \
0121 return this->force_rounding(f(x)); }
0122 BOOST_NUMERIC_INTERVAL_new_func(asinh)
0123 BOOST_NUMERIC_INTERVAL_new_func(atanh)
0124 # undef BOOST_NUMERIC_INTERVAL_new_func
0125 # define BOOST_NUMERIC_INTERVAL_new_func(f) \
0126 T f##_down(const T& x) \
0127 { BOOST_NUMERIC_INTERVAL_using_ahyp(f); \
0128 return -this->force_rounding(-f(x)); } \
0129 T f##_up (const T& x) \
0130 { BOOST_NUMERIC_INTERVAL_using_ahyp(f); \
0131 return this->force_rounding(f(x)); }
0132 BOOST_NUMERIC_INTERVAL_new_func(acosh)
0133 # undef BOOST_NUMERIC_INTERVAL_new_func
0134 };
0135
0136 }
0137 }
0138 }
0139
0140 #endif