Bug 14124 – BigInt %= int can return "-0"

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-02-04T12:52:00Z
Last change time
2015-02-18T03:42:03Z
Assigned to
nobody
Creator
electrolysis.jp+d

Comments

Comment #0 by electrolysis.jp+d — 2015-02-04T12:52:08Z
Separated from issue 13963. Not only int, but any integral types smaller than (u)long. --- import std.bigint; void main() { auto x = BigInt(-3); // Negative BigInt x %= 3; // int assert(x == BigInt(0), toDecimalString(x)); // Bad, x is invalid "-0" x = BigInt(-3); x %= 3L; // long assert(x == BigInt(0)); // Good, different implementation }
Comment #1 by github-bugzilla — 2015-02-07T17:43:29Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/1cabeac6da6ce691a31bf4654179f222a0956137 Fix Issue 14124 - BigInt %= int can return "-0" https://github.com/D-Programming-Language/phobos/commit/9f6e1c33be2001bb44cfcb53f78441b75eb1c718 Merge pull request #2959 from e10s/patch-7 Fix Issue 14124 - BigInt %= int can return "-0"
Comment #2 by github-bugzilla — 2015-02-07T20:32:50Z
Comment #3 by github-bugzilla — 2015-02-18T03:42:03Z