[Issue 9937] CTFE floats don't overflow correctly

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Sep 29 03:48:03 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=9937

--- Comment #24 from Martin Nowak <code at dawg.eu> ---
Also see the discussion in issue 13474 and "The semantics of float, double, and
real" at http://dlang.org/d-floating-point.html, which gives some arguments why
dmd uses -ffast-math behavior by default behavior.

I think the spec argumentation is a bit weak (also see
https://issues.dlang.org/show_bug.cgi?id=13474#c21).

If someone asks to round down (cast(float) or assignment to float) it seems
sensible to do it.
If you're writing performance sensitive numeric code you will avoid to mix
precisions.
DMD is the only C/D/C++ compiler skipping such those roundings by default (w/o
a -ffast-math switch).

In any case we need to align the default behavior of dmd/gdc/ldc.

--


More information about the Digitalmars-d-bugs mailing list