I have a javascript program (running in jsdb that uses Mozilla Spidermonkey 1.8, not a browser) that I need to convert float and doubles to / from the corresponding number of bytes of their IEEE representations. Java Float.floatToIntBits () and Float.intBitsToFloat () and similar methods for Double.
Is there a way to compute these functions in Javascript? (and yes, I know that all javascript numbers are essentially double type)
I think I could follow the javadoc algorithms for Double.longBitsToDouble () and Float.intBitsToFloat () , but this only applies to one direction, and I need both.
source
share