<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>zbentley</author><text>Not at all.&lt;p&gt;If I get floats from $somewhere, I might want to index them into a hash data structure without creating a huge sparse array.&lt;p&gt;If you assume float numbers have &amp;quot;identity&amp;quot; such that, whatever the precision, &amp;quot;x == x&amp;quot; always holds (other than NaN), then this is a perfectly valid thing to want.</text><parent_chain><item><author>bobbylarrybobby</author><text>Using floats as hash keys is insane, no?</text></item><item><author>derriz</author><text>Java has a specific hack for this which I discovered by accident a few years ago.  Normally, given (primitive) double values d0 and d1, then boxing them does not affect equality testing - i.e. d0 == d1 if and only if Double.valueOf(d0).equals(Double.valueOf(d1)).  However if d0 and d1 are both NaN, then the boxed versions ARE considered equal while d0 == d1 is false.&lt;p&gt;This inconsistency infuriated me when I discovered it but the Javadoc for Double.equals explicitly states that this anomaly is there to &amp;quot;allow hash tables to work properly&amp;quot;.</text></item></parent_chain></comment><story><title>Go 1.21 may have a clear(x) builtin</title><url>https://utcc.utoronto.ca/~cks/space/blog/programming/GoFutureClearBuiltin</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>metadat</author><text>Yes, why would you ever want a map with floating point keys?&lt;p&gt;I&amp;#x27;m struggling to think of a valid use case where there is no better alternative.&lt;p&gt;Any design utilizing this language &amp;quot;feature&amp;quot; seems masochistic and begging to get sliced by sheet metal edges.</text><parent_chain><item><author>bobbylarrybobby</author><text>Using floats as hash keys is insane, no?</text></item><item><author>derriz</author><text>Java has a specific hack for this which I discovered by accident a few years ago.  Normally, given (primitive) double values d0 and d1, then boxing them does not affect equality testing - i.e. d0 == d1 if and only if Double.valueOf(d0).equals(Double.valueOf(d1)).  However if d0 and d1 are both NaN, then the boxed versions ARE considered equal while d0 == d1 is false.&lt;p&gt;This inconsistency infuriated me when I discovered it but the Javadoc for Double.equals explicitly states that this anomaly is there to &amp;quot;allow hash tables to work properly&amp;quot;.</text></item></parent_chain></comment><story><title>Go 1.21 may have a clear(x) builtin</title><url>https://utcc.utoronto.ca/~cks/space/blog/programming/GoFutureClearBuiltin</url></story>