Reputation: 35276
I'm trying to convert a floating point to byte array/stream using javascript. My javascript code is passed with a string represented floating point values defined like this:
Code from AS library:
while (buffer.bytesAvailable > 0)
{
ret += buffer.readFloat().toString() + ";";
}
The code above is a Actionscript code, in which the function is defined:
readFloat():Number
Reads an IEEE 754 single-precision (32-bit) floating-point number from the byte stream.
Since I can't modify the AS library as it is already compiled to SWF and exported functions for javascript, I only can resort to converting the output back to bytes with Javascript.
What are the ways to achieve this?
Upvotes: 0
Views: 605
Reputation: 2583
You can parse binary float with that class : http://jsfromhell.com/classes/binary-parser
Upvotes: 1