I want to make a function in pure Lua that generates a fraction (23 bits), an exponent (8 bits), and a sign (1 bit) from a
Have you seen this?
I think it does what you want in a slighty simpler way.