diff --git a/include/boost/numeric/interval/hw_rounding.hpp b/include/boost/numeric/interval/hw_rounding.hpp index 574b243..4330aba 100644 --- a/include/boost/numeric/interval/hw_rounding.hpp +++ b/include/boost/numeric/interval/hw_rounding.hpp @@ -11,6 +11,8 @@ #ifndef BOOST_NUMERIC_INTERVAL_HW_ROUNDING_HPP #define BOOST_NUMERIC_INTERVAL_HW_ROUNDING_HPP +#include + #include #include @@ -46,6 +48,31 @@ namespace boost { namespace numeric { namespace interval_lib { +namespace detail +{ + template + struct runtime_checker + { + protected: + runtime_checker() + { + static helper _; + } + + private: + struct helper + { + helper() + { + save_state > rounding; + T a = -(T(-1.1) * T(10.1)); + T b = +(T(+1.1) * T(10.1)); + assert(a != b); + } + }; + }; +} + /* * Three specializations of rounded_math */ @@ -53,16 +80,19 @@ namespace interval_lib { template<> struct rounded_math : save_state > + , private detail::runtime_checker {}; template<> struct rounded_math : save_state > + , private detail::runtime_checker {}; template<> struct rounded_math : save_state > + , private detail::runtime_checker {}; } // namespace interval_lib