问题
I struggle with the result of my nodejs-JDBC-MSSQL-Binary-ResultValue. From my database I've got this
[-78,119,99,63] // this is an array of signed Chars
In hex, 0xB2, 0x77, 0x63, 0x3F in big endian and 0x3F6377B2 as little endian.
After conversion it has to be this:
0.8885451555252075
But how to do convert this by using javascript or nodejs?
Kind regards
Markus
回答1:
You can use "typed arrays":
var chars = new Uint8Array([-78, 119, 99, 63])
var floats = new Float32Array(chars.buffer)
> [0.8885451555252075]
来源:https://stackoverflow.com/questions/43075424/javascript-how-to-convert-signed-char-array-to-float-maybe-using-ieee754