Boost logo

Boost Users :

Subject: Re: [Boost-users] [chrono] float-based milliseconds?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-08-31 07:03:42


Le 31/08/13 12:26, Michael Powell a écrit :
> On Sat, Aug 31, 2013 at 4:06 AM, Vicente J. Botet Escriba
> <vicente.botet_at_[hidden]> wrote:
>> Le 31/08/13 01:26, Michael Powell a écrit :
>>
>>> Hello,
>>>
>>> Or any of the chrono-steady-clock-based time units...
>>>
>>> I am noticing some what appear to be rounding errors outputting
>>> resulting millisecond values using the boost::chrono::milliseconds(x).
>>>
>>> It's a design-decision, most if not all of our floating-point values
>>> are single-precision-float, don't need to be double-precision-float.
>>>
>>> When we output the milliseconds(x).count() values, however, what I am
>>> finding is that the values are sometimes inaccurate, the same value in
>>> 3.0, for instance, output as 2.99995, stuff like this.
>> Please, could you provide an example an the output you are getting?
>>
>>
>> Is there a way to tell milliseconds what precision floating point it
>> is? float or double?
>>
>> I don't see yet where the double is playing on
>>
>> typedef duration<boost::int_least64_t, milli> milliseconds; // at least
>> 45 bits needed
>>
>> Which version are you using, V1 or V2?
> That's a good question, I don't know. I am including
> <boost/chrono.hpp>, and using boost::chrono::milliseconds,
> boost::chrono::high_resolution_clock::now to source my
> stopwatch/stopwatchelapsedtimer concept.
>
You are using then V1.

Do you mind defining BOOST_CHRONO_VERSION 2, before including the chrono
files or on the command line, so that we can see if the issue is version
speciifc?

Please, post a complete example.

Vicente


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net