AFAICT the pre-hash values come from this method [0] which returns an integer which is a 1:1 representation of the float bytes except that NaNs are all collapsed to one canonical form. So at least at this phase, it doesn't quantize any virtually-equal floats together.
Skimming an implementation of HashMap [1], I didn't notice any obvious "do something special for Floats" code.
[0] https://docs.oracle.com/en/java/javase/17/docs/api/java.base...
[1] https://github.com/openjdk/jdk/blob/master/src/java.base/sha...
> If we continue in this manner we see that all all numbers must have the same hash value h regardless of the choice of ε. The idea of approximate comparison is unfortunately hard to reconcile with the non-approximate nature of hash functions.
I think there is at least one non-sequitur in there? The only thing you prove is that directly modeling hash keys on top of that notion of equality is not useful / the model is weak. I don't think equality is typically associative with epsilon comparison.
(The license of this comment forbids it from being used as support in favor of floats as hash keys)
anematode•2mo ago