Re: [Boost-bugs] [Boost C++ Libraries] #9419: boost::chrono::floor()/round() and negative durations is wrong (was: boost::chrono::floor() and negative durations is wrong)

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9419: boost::chrono::floor()/round() and negative durations is wrong (was: boost::chrono::floor() and negative durations is wrong)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-11-22 17:10:02


#9419: boost::chrono::floor()/round() and negative durations is wrong
-------------------------------+----------------------
  Reporter: 1czajnik@… | Owner: viboes
      Type: Bugs | Status: assigned
 Milestone: To Be Determined | Component: chrono
   Version: Boost 1.54.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+----------------------
Changes (by viboes):

 * status: new => assigned

Comment:

 Replying to [comment:1 1czajnik@…]:
> The attached unit test demonstrates the problem, as well as a problem
 with round<>, which I think doesn't follow the documented rule "tie
 towards even" for negative values.
>
> There are also overflow tests, and they all pass ;-)
>
> My output of this test is:
> {{{
> Running 4 test cases...
> ../chrono_rounding.cpp(28): error in "floor_": check seconds(-2) ==
 floor<seconds>( milliseconds(-1999) ) failed [-2 seconds != -1 second]
> ../chrono_rounding.cpp(29): error in "floor_": check seconds(-2) ==
 floor<seconds>( milliseconds(-1001) ) failed [-2 seconds != -1 second]
> ../chrono_rounding.cpp(31): error in "floor_": check seconds(-1) ==
 floor<seconds>( milliseconds(-999) ) failed [-1 second != 0 seconds]
> ../chrono_rounding.cpp(32): error in "floor_": check seconds(-1) ==
 floor<seconds>( milliseconds(-1) ) failed [-1 second != 0 seconds]
> ../chrono_rounding.cpp(63): error in "round_": check seconds(-2) ==
 round<seconds>( milliseconds(-1500) ) failed [-2 seconds != -1 second]
>
> *** 5 failures detected in test suite "Master Test Suite"
> }}}
>
> HTH, Kris

 Thanks Kris for the report.

 I would take care of it. Clearly we missed the negative numbers :(

 Best,
 Vicente

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9419#comment:2>
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:14 UTC