[Boost-bugs] [Boost C++ Libraries] #5931: numeric::interval equal comparison is strange

Subject: [Boost-bugs] [Boost C++ Libraries] #5931: numeric::interval equal comparison is strange
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-09-23 16:35:39


#5931: numeric::interval equal comparison is strange
---------------------------------------------+------------------------------
 Reporter: Per Karlström <perk@…> | Owner: bgubenko
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: interval
  Version: Boost 1.47.0 | Severity: Showstopper
 Keywords: |
---------------------------------------------+------------------------------
 I find that the interval operator== is somewhat strange. Either I have not
 got exactly how an interval equality operator is supposed to work. Or it
 is plain wrong. Anyway here is the offending code from
 boost/numeric/interval/interval.hpp lines 363 to 371

 template<class T, class Policies> inline
 bool interval<T, Policies>::operator== (const interval_holder& r) const
 {
   if (!checking::is_empty(low, up)) {
     if (up == r.low && low == r.up) return true;
     else if (up < r.low || low > r.up) return false;
   }
   throw interval_lib::comparison_error();
 }

 What surpprises me is how up is compared with r.low and low is comared
 with r.up

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5931>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC