Bug 2987 – D2 phobos BigInt opMul doesn't work correctly

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-05-15T19:11:00Z
Last change time
2015-06-09T01:27:59Z
Keywords
patch
Assigned to
andrei
Creator
rinick

Attachments

IDFilenameSummaryContent-TypeSize
375bigint.patchpatch to fix bug 2987text/plain977

Comments

Comment #0 by rinick — 2009-05-15T19:11:42Z
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.