[Issue 12974] Integer constant exponentiation gives wrong value

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jun 24 03:37:07 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12974

safety0ff.bugz <safety0ff.bugz at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|All                         |x86_64

--- Comment #6 from safety0ff.bugz <safety0ff.bugz at gmail.com> ---
(In reply to bearophile_hugs from comment #5)
> 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 
> }

Bah, I screwed up the constants, that second constant is the one for 3^40.
The bug is still there on 64bit once I fixed the constants.
http://dpaste.dzfl.pl/51133cbb1d74
Marking as 64 bit only.

--


More information about the Digitalmars-d-bugs mailing list