[Issue 360] Compile-time floating-point calculations are sometimes inconsistent
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Sep 21 16:31:36 PDT 2006
http://d.puremagic.com/issues/show_bug.cgi?id=360
bugzilla at digitalmars.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
------- Comment #1 from bugzilla at digitalmars.com 2006-09-21 18:31 -------
The example is mixing up 3 different precisions - 32, 64, and 80 bit. Each
involves different rounding of unrepresentable numbers like 0.2. In this case,
the 1.0f/STEP_SIZE is calculated at different precisions based on how things
are compiled. Constant folding, for example, is done at compile time and done
at max precision even if the variables involved are floats.
The D language allows this, the guiding principle is that algorithms should be
designed to not fail if precision is increased.
Not a bug.
--
More information about the Digitalmars-d-bugs
mailing list