Warning, file /include/boost/numeric/interval/detail/c99sub_rounding_control.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_NUMERIC_INTERVAL_DETAIL_C99SUB_ROUNDING_CONTROL_HPP
0012 #define BOOST_NUMERIC_INTERVAL_DETAIL_C99SUB_ROUNDING_CONTROL_HPP
0013
0014 #include <boost/detail/fenv.hpp> // ISO C 99 rounding mode control
0015
0016 namespace boost {
0017 namespace numeric {
0018 namespace interval_lib {
0019 namespace detail {
0020
0021 extern "C" { double rint(double); }
0022
0023 struct c99_rounding_control
0024 {
0025 typedef int rounding_mode;
0026
0027 static void set_rounding_mode(rounding_mode mode) { fesetround(mode); }
0028 static void get_rounding_mode(rounding_mode &mode) { mode = fegetround(); }
0029 static void downward() { set_rounding_mode(FE_DOWNWARD); }
0030 static void upward() { set_rounding_mode(FE_UPWARD); }
0031 static void to_nearest() { set_rounding_mode(FE_TONEAREST); }
0032 static void toward_zero() { set_rounding_mode(FE_TOWARDZERO); }
0033
0034 template<class T>
0035 static T to_int(const T& r) { return rint(r); }
0036 };
0037
0038 }
0039 }
0040 }
0041 }
0042
0043 #endif