Heavenly delights of hashing numbers under EQUALP
Web page · https://turtleware.eu/posts/Heavenly-delights-of-hashing-numbers-under-EQUALP.html
First seen by Oriel on .
AI summary
The post develops a precise, low-allocation scheme for hashing Common Lisp numbers consistently under EQUALP by canonicalizing dyadic rationals as sign, mantissa, and exponent tuples.
- An initial scheme hashes integers directly, integral floats as integers, non-integral floats as double-floats, and non-dyadic ratios as numerator-denominator pairs.
- The first implementation improved ECL's HTABLE-MIXBAG benchmark by 100x after distinct hashes were restored for randomized non-integer floats.
- The initial scheme can allocate up to 2KB per large integer-valued float and loses long-float precision when converting to double-float.
- The revised scheme normalizes dyadic values to a sign of -1, 0, or +1, a positive odd mantissa or zero, and an integer exponent.
- Non-dyadic ratios and non-real complexes retain type tags and hash their components; zero-imaginary complexes hash as their real part.
#common lisp #hash tables #ecl #numeric hashing
Generated by gpt-5.6-sol. Check the original for details.
Metric trends
Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained
Points
Score reported by the source.
- Lobsters: 12, latest observation ; +11 over observed period since
Comments
Comment count reported by the source.
- Lobsters: 0, latest observation ; 0 over observed period since
Aliases
| Source | External ID | URL |
|---|---|---|
| Lobsters | 0ta2mv | https://turtleware.eu/posts/Heavenly-delights-of-hashing-numbers-under-EQUALP.html Read discussion |