Le 26/02/2019 à 06:02, Micah Kornfield a écrit : > Implementing compute kernels that depend on hashing has raised a couple of > edge cases that are worth discussing. In particular > the following points need to be resolved (I opened a JIRA [1] to track the > fixes). In particular: > > 1. How to handle -0.0 and 0.0? > - Option 1: Collapse to a single value (this is more inline with ieee-754 > spec I believe) > - Option 2: Keep them as separate values (I believe this is how java > handles them)
My intuition would be to keep them as separate values. If you end up with negative zeros it probably means something. But I'm not a database expert. > 2. How handle NaN? > - Option 1: Do nothing with them (multiple values of NaN might occur in > hashtables) > - Option 2: Canonicalize to a single NaN (this is what java does) Canonicalizing sounds fine. The more general question about float hashing is that most floating-point values are approximations obtained after rounding, so it's not obvious how useful float hashing is. Regards Antoine.