Bug 17243 – std.math.{FloatingPointControl,ieeeFlags} don't work on x86_64
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-03-04T15:22:52Z
Last change time
2018-01-05T13:27:43Z
Keywords
pull
Assigned to
ag0aep6g
Creator
ag0aep6g
Comments
Comment #0 by ag0aep6g — 2017-03-04T15:22:52Z
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.