[Issue 9937] CTFE floats don't overflow correctly

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Feb 15 23:29:14 PST 2015


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

--- Comment #22 from yebblies <yebblies at gmail.com> ---
Just for reference, the exact cause of the trouble for the specific case in
issue 13474 is that floating point expressions can be evaluated with different
precision within the same code.

eg this assertion could fail:
double a;
double b;
double c;
assert(a + b - c == a + b - c);

Because it could be evaluated as
(a + b - c) == cast(double)(cast(real)a + cast(real)b - cast(real)c)

This is a little disturbing.

--


More information about the Digitalmars-d-bugs mailing list