[Issue 17243] New: std.math.FloatingPointControl doesn't work on x86_64

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Mar 4 07:22:52 PST 2017


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

          Issue ID: 17243
           Summary: std.math.FloatingPointControl doesn't work on x86_64
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: ag0aep6g at gmail.com

Compile with dmd (e.g. 2.073.0) and run:

----
void main()
{
    import std.math;
    FloatingPointControl fpctrl;

    fpctrl.rounding = FloatingPointControl.roundUp;
    float u = 1;
    u += 0.1;

    fpctrl.rounding = FloatingPointControl.roundDown;
    float d = 1;
    d += 0.1;

    assert(u > d); /* fails; should pass */
}
----

Similar tests can be constructed for floating point exception flags and masks.

The problem is that dmd generates SSE additions, but FloatingPointConrol
doesn't affect SSE's control/status register MXCSR.

See also issue 5323.

--


More information about the Digitalmars-d-bugs mailing list