Max Stern Max Stern - 1 year ago 127
Javascript Question

Parse HEX float

I have integer, for example,


How I can get HEX float (
) from it?

JS hasn't
type, so I don't know how to do this conversion.

Thank you.

Answer Source

If you want a hex string, try this:

> var b = new Buffer(4);
> b.writeFloatLE(4060, 0)
> b.toString('hex')

And the other way (using your input):

> Buffer('34C87D45', 'hex').readFloatLE(0)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download