Ticket #12018: rounded_arith.patch

File rounded_arith.patch, 1.5 KB (added by peter.azmanov@…, 7 years ago)
  • boost/include/boost/numeric/interval/rounded_arith.hpp

    From: Peter Azmanov <peter.azmanov@gmail.com>
    Date: Wed, 24 Feb 2016 13:41:07 +0300
    Subject: [PATCH] boost-interval: workaround: msvc 14 optimizations prevent
     rounding to work as expected
    
    ---
     boost/include/boost/numeric/interval/rounded_arith.hpp | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/boost/include/boost/numeric/interval/rounded_arith.hpp b/boost/include/boost/numeric/interval/rounded_arith.hpp
    index 2520274..20a6da6 100644
    a b struct rounded_arith_opp: Rounding {  
    9292# define BOOST_UP_NEG(EXPR) return -this->force_rounding(EXPR)
    9393  template<class U> T conv_down(U const &v) { BOOST_UP_NEG(-v); }
    9494  template<class U> T conv_up  (U const &v) { BOOST_UP(v); }
    95   T add_down(const T& x, const T& y) { BOOST_UP_NEG((-x) - y); }
     95  T add_down(const T& x, const T& y) { BOOST_UP_NEG(this->force_rounding(-x) - y); }
    9696  T sub_down(const T& x, const T& y) { BOOST_UP_NEG(y - x); }
    97   T mul_down(const T& x, const T& y) { BOOST_UP_NEG(x * (-y)); }
    98   T div_down(const T& x, const T& y) { BOOST_UP_NEG(x / (-y)); }
     97  T mul_down(const T& x, const T& y) { BOOST_UP_NEG(x * this->force_rounding(-y)); }
     98  T div_down(const T& x, const T& y) { BOOST_UP_NEG(x / this->force_rounding(-y)); }
    9999  T add_up  (const T& x, const T& y) { BOOST_UP(x + y); }
    100100  T sub_up  (const T& x, const T& y) { BOOST_UP(x - y); }
    101101  T mul_up  (const T& x, const T& y) { BOOST_UP(x * y); }