Javascript – binary to float

It is to my great surprise that byte array to float does not already exist in javascript.  Maybe I am missing something, it seems pretty rudimentary.

Anyhow, it is holiday season and a great time to romanticize those days of intro to programming from college.  Digging around on the web led me to a great applet for binary<->float demonstration as well as a tutorial for IEEE754.

Three things I have re-learned today in float, sign bit (0), exponent bits (1-9) and mantissa bits (10-32).  Here is my bytesToFloat exercise.

DecodeFloat

Leave a Reply