TickDuration deprecation

Timon Gehr timon.gehr at gmx.ch
Tue Nov 21 21:40:49 UTC 2017


On 21.11.2017 21:52, Walter Bright wrote:
> On 11/18/2017 8:17 AM, Jonathan M Davis wrote:
>> Folks have asked for the ability to create Durations from floating point
>> values too, and I rejected that for the same reason - using floating 
>> point
>> values with time is just begging for bugs, and Walter backed me up on 
>> that
>> one.
> 
> Yup. It's the same reason one does not do accounting with floating point.
> ...

The use case here is plotting the time taken by an algorithm depending 
on instance size.

> Computer clocks have discrete ticks, they are not continuous.

That may be true, but the plotting library may still just expect a list 
of doubles. What's the point of removing the simple conversion function 
that was already available for such use cases? This is a breaking change 
with zero benefits.

> The behavior maps cleanly onto integral math,

I'm not doing computations on times. I could just use Duration for that.

> not fuzzy fp math.
> 

There is nothing fuzzy about floating point operations, but still, yes, 
for some use cases, the tiny rounding error will just not matter.


More information about the Digitalmars-d mailing list