digitalmars.D.bugs - [Issue 361] New: Compile-time floating-point calculations are sometimes inconsistent
- d-bugmail puremagic.com (28/28) Sep 21 2006 http://d.puremagic.com/issues/show_bug.cgi?id=361
- d-bugmail puremagic.com (10/10) Sep 21 2006 http://d.puremagic.com/issues/show_bug.cgi?id=361
http://d.puremagic.com/issues/show_bug.cgi?id=361 Summary: Compile-time floating-point calculations are sometimes inconsistent Product: D Version: 0.167 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: digitalmars-com baysmith.com The following code should print false before it exits. import std.stdio; void main() { const float STEP_SIZE = 0.2f; float j = 0.0f; while (j <= ( 1.0f / STEP_SIZE)) { j += 1.0f; writefln(j <= ( 1.0f / STEP_SIZE)); } } This problem does not occur when: 1. the code is optimized 2. STEP_SIZE is not a const 3. STEP_SIZE is a real --
Sep 21 2006
http://d.puremagic.com/issues/show_bug.cgi?id=361 digitalmars-com baysmith.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE Accidental reload by browser. *** This bug has been marked as a duplicate of 360 *** --
Sep 21 2006