digitalmars.D.bugs - [Issue 14124] New: BigInt %= int can return "-0"
- via Digitalmars-d-bugs (27/27) Feb 04 2015 https://issues.dlang.org/show_bug.cgi?id=14124
https://issues.dlang.org/show_bug.cgi?id=14124 Issue ID: 14124 Summary: BigInt %= int can return "-0" Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: Phobos Assignee: nobody puremagic.com Reporter: electrolysis.jp+d gmail.com 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 } --
Feb 04 2015