[Issue 12974] Integer constant exponentiation gives wrong value
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Jun 24 03:30:37 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12974
--- Comment #5 from bearophile_hugs at eml.cc ---
With the latest alpha compiler this works correctly on my Windows 32 bit:
void main() {
import std.math;
immutable ulong r2 = 12157665459056928801uL;
immutable ulong three = 3uL;
assert(three ^^ 40uL == r2); // OK
assert(3uL ^^ 40uL == r2); // OK
}
While this shows the problem:
void main() {
import std.math;
ulong X = uint.max;
assert(X ^^ 2uL == 18446744065119617025uL); // OK
assert(ulong(uint.max) ^^ 2uL == 12157665459056928801uL); // Fails
}
--
More information about the Digitalmars-d-bugs
mailing list