[Issue 2987] D2 phobos BigInt opMul doesn't work correctly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 15 19:15:32 PDT 2009


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


ZHOU Zhenyu <rinick at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rinick at gmail.com




--- Comment #1 from ZHOU Zhenyu <rinick at gmail.com>  2009-05-15 19:15:31 PDT ---
The test code should be.
  BigInt a = 10;
  BigInt b = a * a;
  foreach (i; 2..100)
  {
     assert(a * a == b);
     a *= i;
     b *= i * i;
  }

sorry for the typo

(In reply to comment #0)
> It won't pass this test
> 
>  BigInt a = 10;
>  BigInt b = a * a;
>  foreach (i; 0..100)
>  {
>     assert(a * a == b);
>     a *= i;
>     b *= i * i;
>  }
> 
> To fix this bug.
> Find this around BigInt.d line 907
> 
>     c = updateShr(c);
> 
> replace it with
> 
>     c = updateUShr(c);

-- 
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