digitalmars.D.bugs - [Issue 12234] New: BigInt both >0 and ==0
- d-bugmail puremagic.com (45/45) Feb 23 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12234
- d-bugmail puremagic.com (14/14) Feb 23 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12234
- d-bugmail puremagic.com (13/13) Feb 23 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12234
- d-bugmail puremagic.com (9/9) Mar 14 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12234
https://d.puremagic.com/issues/show_bug.cgi?id=12234 Summary: BigInt both >0 and ==0 Product: D Version: D2 Platform: x86_64 OS/Version: Linux Status: NEW Severity: major Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: killebrew.daniel gmail.com 14:56:51 PST --- There seems to be a bug in BigInt where a value==0, but value>0==true. import std.stdio; import std.bigint; void main() { { //works BigInt evil = 107; int counter; while (evil != 0){ evil /= 10; } } { //fails BigInt evil = 107; int counter; while (evil > 0){ evil /= 10; ++counter; if(counter > 5) { assert(evil == 0); throw new Exception("evil==0, but we're still looping, so evil>0... this doesn't make sense"); } } } } The code will throw the exception. The evil==0 comparison works as expected. The evil>0 comparison gives a wrong answer. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 23 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12234 Daniel Killebrew <killebrew.daniel gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID 16:17:27 PST --- Actually, it looks like this has been fixed in Phobos master. https://github.com/D-Programming-Language/phobos/blob/master/std/internal/math/biguintcore.d#L220 However, I will submit a pull request with unittest for this case, to prevent regression. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 23 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12234 safety0ff.bugz <safety0ff.bugz gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |safety0ff.bugz gmail.com Resolution|INVALID |DUPLICATE 17:43:48 PST --- already be there to prevent regression. *** This issue has been marked as a duplicate of issue 11583 *** -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 23 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12234 Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/30999e7dc15945183a06c9cbf9bf8464704cadcb Add unittests: compare BigUint(0) to 0UL to prevent regression of bug 12234. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 14 2014