[Issue 5568] A problem with BigInt modulus
http://d.puremagic.com/issues/show_bug.cgi?id=5568 Don changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Comment #7 from Don 2011-02-23 13:34:57 PST --- Fixed: https://github.com/D-Programming-Language/phobos/commit/9ecf947290f1149e1b062a75dafd30326697fe00 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5568] A problem with BigInt modulus
http://d.puremagic.com/issues/show_bug.cgi?id=5568 --- Comment #6 from Don 2011-02-19 06:13:57 PST --- And the original test case is: import std.bigint; void main() { BigInt m = (BigInt(1) << (4846+4843) ) - 1; BigInt a = (BigInt(1) << 4846 ) - 1; BigInt b = (BigInt(1) << (4846*2 + 4843)) - 1; BigInt c = (BigInt(1) << (4846*2 + 4843*2)) - 1; BigInt w = c - b + a; assert(w % m == 0); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5568] A problem with BigInt modulus
http://d.puremagic.com/issues/show_bug.cgi?id=5568 --- Comment #5 from Don 2011-02-19 00:50:51 PST --- Reduced test case: import std.bigint; void main() { enum int Y = 2008; BigInt m = (BigInt(1) << (Y*1 + 1)) - 1; BigInt b = (BigInt(1) << (Y*2 + 1)) - 1; BigInt c = (BigInt(1) << (Y*3 + 1)) - 1; BigInt w = c - b; w = w % m; } This trips an assert when Phobos is compiled in debug mode. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5568] A problem with BigInt modulus
http://d.puremagic.com/issues/show_bug.cgi?id=5568 --- Comment #4 from Don 2011-02-13 07:24:38 PST --- (In reply to comment #3) > (In reply to comment #2) > > > Have you tried writefln? > > > > import std.stdio; > > import std.bigint; > > > > void main() > > { > > BigInt a = 7; > > a ^^=56; > > writefln("%x", a); > > writefln("%s", a); > > } > > I have never tried that. I suggest to add this example to docs of the > std.bigint module :-) Yes, although I think it's pretty obvious. The non-obvious thing, is that if you tried in on 2.050 or earlier, it didn't work... It does now. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5568] A problem with BigInt modulus
http://d.puremagic.com/issues/show_bug.cgi?id=5568 --- Comment #3 from bearophile_h...@eml.cc 2011-02-13 05:58:03 PST --- (In reply to comment #2) > Have you tried writefln? > > import std.stdio; > import std.bigint; > > void main() > { > BigInt a = 7; > a ^^=56; > writefln("%x", a); > writefln("%s", a); > } I have never tried that. I suggest to add this example to docs of the std.bigint module :-) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5568] A problem with BigInt modulus
http://d.puremagic.com/issues/show_bug.cgi?id=5568 Don changed: What|Removed |Added CC||clugd...@yahoo.com.au --- Comment #2 from Don 2011-02-13 00:20:33 PST --- (In reply to comment #1) > Problem originally found by tsukikage. > > A handy printing function for BigInts is really needed in Phobos. Have you tried writefln? import std.stdio; import std.bigint; void main() { BigInt a = 7; a ^^=56; writefln("%x", a); writefln("%s", a); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5568] A problem with BigInt modulus
http://d.puremagic.com/issues/show_bug.cgi?id=5568 --- Comment #1 from bearophile_h...@eml.cc 2011-02-12 17:20:01 PST --- Problem originally found by tsukikage. A handy printing function for BigInts is really needed in Phobos. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---