On Saturday, 18 November 2017 at 16:17:00 UTC, Jonathan M Davis wrote:
On Saturday, November 18, 2017 15:03:05 Timon Gehr via Digitalmars-d wrote:
[...]

core.time and std.datetime avoid floating point math, because using it introduces errors into the calculations. It does make some sense to generate a floating point value if all you're looking to do is print it out at the end, but using floating point values in the calculations is a source of bugs - e.g. converting between clock frequencies using floating point values would be particularly bad, much as it's the obvious first implementation; core.time.convClockFreq does it all with integral math and avoids the problem and even manages to support a higher range of values in the process than it would if it were implemented with double or real.

[...]

If you ask me, then time durations doesn't make sense as anything else other than signed integers.

I can see that you can do something like "0.5" for half a second, but really you shouldn't be doing the duration in seconds then, but rather in milliseconds and pass 500 for half a second.

So please, I hope it never gets added.

That's just my two cents.

Especially seeing how flawed floating points are.

Reply via email to