[Issue 13052] New: TypeInfo.getHash should return same hash for different floating point zeros.
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Jul 5 20:32:59 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13052
Issue ID: 13052
Summary: TypeInfo.getHash should return same hash for different
floating point zeros.
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: wrong-code
Severity: major
Priority: P1
Component: druntime
Assignee: nobody at puremagic.com
Reporter: k.hara.pg at gmail.com
Test case:
void main()
{
alias F = float;
F f1 = +0.0, f2 = -0.0;
assert(f1 !is f2); // they have different bit representations
assert(f1 == f2); // but they are equal
TypeInfo ti = typeid(F);
assert(ti.getHash(&f1) == ti.getHash(&f2));
// if f1 and f2 are equal, their hash values should also be equal
}
--
More information about the Digitalmars-d-bugs
mailing list