September 21, 2006 [Issue 361] New: Compile-time floating-point calculations are sometimes inconsistent | ||||
---|---|---|---|---|
| ||||
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 -- |
September 21, 2006 [Issue 361] Compile-time floating-point calculations are sometimes inconsistent | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=361 digitalmars-com@baysmith.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE ------- Comment #1 from digitalmars-com@baysmith.com 2006-09-21 18:46 ------- Accidental reload by browser. *** This bug has been marked as a duplicate of 360 *** -- |
Copyright © 1999-2021 by the D Language Foundation