TickDuration deprecation
sarn
sarn at theartofmachinery.com
Wed Nov 22 23:55:30 UTC 2017
On Wednesday, 22 November 2017 at 22:17:05 UTC, Walter Bright
wrote:
> On 11/22/2017 5:45 AM, Steven Schveighoffer wrote:
>> 1. All OS calls with timing requirements use non-floating
>> point to represent how long to sleep. After all a CPU uses
>> discrete math, and the timing implementation is no different.
>
> Microsoft has numerous COM APIs for time functions. One of them
> I had to deal with used doubles to represent seconds. This had
> to be interfaced with other time functions that used integers.
> The trouble came from round trips - there were cases where
> double=>integer=>double did not produce the same result. Even
> worse,
>
> double=>integer=>double=>integer=>double ...
>
> produced a creeping shift in the value! It took much time to
> come up with a method of preventing such drift, and even that
> was unreliable.
It's fixed point, not floating point, but this famous software
disaster is a pretty dramatic example:
http://www-users.math.umn.edu/~arnold/disasters/patriot.html
+1 to using integer arithmetic for the low-level time APIs.
More information about the Digitalmars-d
mailing list