Bitwise conversion of doubles using only FP multiplication and addition (2020)
dougallj.wordpress.com26 points by vitaut 14 hours ago
26 points by vitaut 14 hours ago
I love these "what if you only had X" puzzles. The constraint here (no bit access, only FP multiply and add) sounds impossible until you realize rounding behavior carries information.
The edge cases around negative zero and infinities make sense. Those values break the mathematical properties you'd need to distinguish them.
Recommended readings:
Jim McCann, Tom Murphy VII, The fluint8 Software Integer Library. https://tom7.org/papers/fluint.pdf
Tom Murphy VII, GradIEEEnt half decent. https://tom7.org/grad/murphy2023grad.pdf