You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this is quite bad because anything that is between two integers gets hashed to the same value. my hash table essentially turned into a linear array because most of the values happened to be in the [0; 1] range.
the same applies to hashes for other floating point types (double, long double etc.).
when fixing this, keep in mind that floating point numbers have two representations for 0 (0 and -0) - those two bit patterns should hash to the same value because they represent the same number.
The text was updated successfully, but these errors were encountered:
the default hash for floats works by casting the value to
size_t
:this is quite bad because anything that is between two integers gets hashed to the same value. my hash table essentially turned into a linear array because most of the values happened to be in the [0; 1] range.
the same applies to hashes for other floating point types (double, long double etc.).
when fixing this, keep in mind that floating point numbers have two representations for 0 (0 and -0) - those two bit patterns should hash to the same value because they represent the same number.
The text was updated successfully, but these errors were encountered: