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);
Comment #1 by rinick — 2009-05-15T19:15:31Z
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);
Comment #2 by rinick — 2009-05-17T19:25:38Z
Created attachment 375
patch to fix bug 2987
fix the bug (line 907)
add a testcase
Comment #3 by clugdbug — 2009-08-28T05:47:53Z
Thanks!
Actually both cases of updateShr should probably be updateUShr, although AFAICT the result of the second one is never actually used, so it's a bit irrelevant.
Fixed in svn 1251.