[Issue 14958] Casting a double to ulong sometimes produces wrong results
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Aug 27 05:37:11 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14958
ag0aep6g at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ag0aep6g at gmail.com
--- Comment #7 from ag0aep6g at gmail.com ---
(In reply to Steven Schveighoffer from comment #6)
> I think that's where I see there is an issue. Only when you actually assign
> it to a double does it become concretely double.
With -O that doesn't cut it either.
----
void main()
{
import std.stdio;
double x = 1.2;
double d = x * 10.0;
writeln(cast(ulong) d);
}
----
`dmd test.d && ./test` -> 12
`dmd -O test.d && ./test` -> 11
--
More information about the Digitalmars-d-bugs
mailing list