On 8/24/15 5:34 PM, "=?UTF-8?B?Ik3DoXJjaW8=?= Martins\"
<[email protected]>\"" wrote:
On Monday, 24 August 2015 at 21:03:50 UTC, Steven Schveighoffer wrote:
I understand the inconsistency, and I agree it is an issue that should
be examined. But the issue is entirely avoidable by not using
incorrect methods to convert from floating point to integer after
floating point operations introduce some small level of error.
Perhaps there is some way to make it properly round in this case, but
I guarantee it will not fix all floating point errors.
What is the correct way to truncate, not round, a floating-point value
to an integer?
auto result = cast(ulong)(x * 10.0 + x.epsilon);
-Steve