[Issue 19073] New: core.internal.hash should not bitwise hash representations of floating point numbers
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jul 10 14:41:44 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19073
Issue ID: 19073
Summary: core.internal.hash should not bitwise hash
representations of floating point numbers
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: druntime
Assignee: nobody at puremagic.com
Reporter: n8sh.secondary at hotmail.com
Currently `hashOf(float)` coalesces all NaNs to have the same hash code when
they are hashed directly, but not when they appear as fields of structs or as
elements of static arrays or as elements of dynamic arrays.
```
void main()
{
import core.internal.hash : hashOf;
static struct S { float value; }
assert(hashOf(float.nan) == hashOf(-float.nan)); // Passes.
assert(hashOf(S(float.nan)) == hashOf(S(-float.nan))); // Fails!
}
```
--
More information about the Digitalmars-d-bugs
mailing list