Bug 13457 – float version of isIdentical fails

Status
RESOLVED
Resolution
WONTFIX
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2014-09-11T05:30:56Z
Last change time
2019-04-12T14:50:41Z
Keywords
wrong-code
Assigned to
No Owner
Creator
Илья Ярошенко

Comments

Comment #0 by ilyayaroshenko — 2014-09-11T05:30:56Z
bool isIdentical(float x, float y) @trusted pure nothrow @nogc { // We're doing a bitwise comparison so the endianness is irrelevant. int* pxs = cast(int *)&x; int* pys = cast(int *)&y; return pxs[0] == pys[0]; } unittest { float fn1 = NaN(0xABC); float fn2 = NaN(0xABC); assert(isIdentical(fn1, fn2)); //<--- fails on Darwin_32 } See #2509 https://github.com/D-Programming-Language/phobos/pull/2509
Comment #1 by ilyayaroshenko — 2014-09-11T05:42:20Z
Comment #2 by yebblies — 2016-03-20T10:29:28Z
Can anyone reproduce this with the latest compiler?
Comment #3 by ilyayaroshenko — 2019-04-12T14:50:41Z
Darwin_32 is no longer supported