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.
Comment #1 by ag0aep6g — 2017-03-04T15:32:48Z
Comment #2 by ag0aep6g — 2017-03-04T18:43:28Z
std.math.ieeeFlags is affected as well. ---- void main() { import std.math; float x = 1; x /= 0; assert(ieeeFlags.divByZero); /* fails; should pass */ } ----
Comment #3 by github-bugzilla — 2017-03-14T10:50:44Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/09679c241f9ab4554e5bdabee998fd319e2eb4ac fix issue 17243 - std.math.{FloatingPointControl,ieeeFlags} don't work on x86_64 https://github.com/dlang/phobos/commit/83e199977607752df16167c557e2c0f5acb12be5 Merge pull request #5240 from aG0aep6G/FloatingPointControl fix issue 17243 - std.math.{FloatingPointControl,ieeeFlags} don't work on x86_64
Comment #4 by github-bugzilla — 2017-03-22T12:05:26Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/09679c241f9ab4554e5bdabee998fd319e2eb4ac fix issue 17243 - std.math.{FloatingPointControl,ieeeFlags} don't work on x86_64 https://github.com/dlang/phobos/commit/83e199977607752df16167c557e2c0f5acb12be5 Merge pull request #5240 from aG0aep6G/FloatingPointControl
Comment #5 by github-bugzilla — 2017-08-07T12:26:24Z
Commits pushed to newCTFE at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/09679c241f9ab4554e5bdabee998fd319e2eb4ac fix issue 17243 - std.math.{FloatingPointControl,ieeeFlags} don't work on x86_64 https://github.com/dlang/phobos/commit/83e199977607752df16167c557e2c0f5acb12be5 Merge pull request #5240 from aG0aep6G/FloatingPointControl
Comment #6 by github-bugzilla — 2018-01-05T13:27:43Z
Commits pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/09679c241f9ab4554e5bdabee998fd319e2eb4ac fix issue 17243 - std.math.{FloatingPointControl,ieeeFlags} don't work on x86_64 https://github.com/dlang/phobos/commit/83e199977607752df16167c557e2c0f5acb12be5 Merge pull request #5240 from aG0aep6G/FloatingPointControl