Bug 13052 – TypeInfo.getHash should return same hash for different floating point zeros.
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-07-06T03:32:00Z
Last change time
2015-02-18T03:38:09Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2014-07-06T03:32:59Z
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
}