Migration Guide : Migrating from Version 8.0.3 : Change Float and Scaled Decimal 32-bit hash for better distribution
Change Float and Scaled Decimal 32-bit hash for better distribution
Reason for change
The current result of sending abtHash32 to a Float or a ScaledDecimal has a very bad distribution:
2 Float or Scaled Decimal objects whose only difference is to the right of the decimal point hash to the same value
Large Float or ScaledDecimal objects all hash to the same value
The signs of Float or Scaled Decimal objects are ignored when calculating their hash value
Change
Float>>abtHash32: and ScaledDecimal>>abtHash32: have been implemented. These methods treat the Float or ScaledDecimal like a ByteArray (possible because their internal representation is a ByteArray), thus giving a more uniform distribution of hash values.
Action required
If your application uses Float or ScaledDecimal objects as keys for any keyed collection (such as AbtHighCapacityDictionary) that uses abtHash32 to calculate the hash values of its keys, you must recompute the hash values for that collection after installing the current version of VA Smalltalk and before modifying the collection in any way. To recompute the hash values, send the rehash message to the collection. For example:
myDictionaryKeyedWithScaledDecimals rehash.
Last modified date: 07/02/2019