3 ms·
I don't know what precisely the poster meant. However, from my perspective, I see it as a simpler design to explicitly hash float values into keys.
by malcolmgreaves 4y ago
I don't know what precisely the poster meant. However, from my perspective, I see it as a simpler design to explicitly hash float values into keys.
- masklinn 4y agoThat... still requires the foresight to see that edge case, and being in a situation where you're not colliding your float hashes with random integers?
- kazinator 4y agoExternally hashing outside of the hash table requires you to take on ugly complications. What if two distinct floating point keys map to the same key? The values of your hash table then have to be lists or arrays so you can keep all colliding entries. You've then wastefully built chained hashing around a hash table!
- metadat 4y agoThe same approach I suggested elsewhere in this thread will work for this case, too. Convert floats to their string representations and key off that. Equality ambiguity problem solved.