[Issue 13457] New: float version of isIdentical fails
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Sep 10 22:30:56 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13457
Issue ID: 13457
Summary: float version of isIdentical fails
Product: D
Version: D2
Hardware: x86
OS: Mac OS X
Status: NEW
Severity: blocker
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: ilyayaroshenko at gmail.com
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
--
More information about the Digitalmars-d-bugs
mailing list