[Issue 6819] New: BigInt ^^ fails for some big numbers (powers)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 16 16:17:37 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6819

           Summary: BigInt ^^ fails for some big numbers (powers)
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: redhatbugzilla at yopmail.com


--- Comment #0 from Olivier Fabre <redhatbugzilla at yopmail.com> 2011-10-16 16:16:40 PDT ---
With dmd 2.055 under Linux x86-64, (BigInt(10)^^p)^^2 doesn't return the
correct result starting from p == 32:

import std.stdio, std.bigint;
void main() {
    for( int p = 0 ; p < 40 ; p++ ) {
        BigInt n = BigInt(10)^^p;
        BigInt a = n*n;
        BigInt b = n^^2;
        if( a != b ) {
            writefln( "%s %s %s %s", p, n, a, b );
        }
    }
}

It also fails with BigInt(2)^^p (from p==32 too) and BigInt(20)^^p (from
p==16).

Values like (BigInt(2)^^32+1)^^2 are computed correctly.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list