July 10, 2018 [Issue 19073] New: core.internal.hash should not bitwise hash representations of floating point numbers | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: n8sh.secondary@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! } ``` -- |
Copyright © 1999-2021 by the D Language Foundation