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);
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);
Created attachment 375 [details] patch to fix bug 2987 fix the bug (line 907) add a testcase
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.