I have a javascript program (running in jsdb which uses Mozilla Spidermonkey 1.8, not in a browser) that I need to convert float and doubles to/from the appropriate number of bytes of their IEEE representations. Java has [Float.floatToIntBits()](http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Float.html#floatToIntBits%28float%29) and [Float.intBitsToFloat()](http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Float.html#intBitsToFloat%28int%29) 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 of type double)

I guess I could follow the algorithms in the javadoc for [Double.longBitsToDouble()](http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Double.html#longBitsToDouble%28long%29) and [Float.intBitsToFloat()](http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Float.html#intBitsToFloat%28int%29) but that only covers one direction, and I need both.