Bug 4452 – Incorrect result of BigInt ^^ long

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-07-13T04:50:00Z
Last change time
2010-07-14T00:07:45Z
Assigned to
nobody
Creator
yebblies

Comments

Comment #0 by yebblies — 2010-07-13T04:50:21Z
BigInt give incorrect results for a^^b for a select set of numbers: 12 ^^ 16 48 ^^ 8 48 ^^ 16 80 ^^ 8 112 ^^ 8 144 ^^ 8 176 ^^ 8 192 ^^ 16 208 ^^ 8 etc Test case: void main() { BigInt bpow(long a, long b) { auto r = BigInt(1); while(b--) r *= a; return r } foreach(a; 0..1000) { foreach(b; 0..1000) { auto r1 = bpow(a, b); auto r2 = BigInt(a) ^^ b; assert(r1 == r2); } } } Version of std.bigint packaged with dmd2.047 Have not checked on other hardware/os
Comment #1 by clugdbug — 2010-07-14T00:07:45Z
Fixed in Phobos svn 1757.