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

Steven Schveighoffer <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #2 from Steven Schveighoffer <[email protected]> ---
I'm not sure whether this is a bug or not, but the behavior comes down to the
conversion from real to double vs. to ulong.

This code can demonstrate:

import std.stdio;
void main() {
    double x = 1.2;
    double x2 = x * 10.0;
    real y = x * 10.0;
    real y2 = x2;
    double y3 = y;
    writefln("%a, %a, %a", y, y2, cast(real)y3);
}

This outputs:

0xb.ffffffffffffep+0, 0xcp+0, 0xcp+0

Showing that in real representation, the number is not exact, but when
converted to double, it does represent what is asked for. However, we know that
the conversion definitely is rounding somehow because the original number isn't
precise.

--

Reply via email to