0

I have a buffer in NodeJS, and it received serialized data from a bluetooth device.

The serialized data is IEEE single floating-point representation, where the offset is at 21th bit.

accX = data.readUInt32LE(2);
accX = accX >> 4;

In C, I could do a memcpy to get the float number. How could I parse float in Javascript?

Dzung Nguyen
  • 3,794
  • 9
  • 48
  • 86

1 Answers1

0

Install

npm install ieee754

Read the buffer

var ieee754 = require('ieee754')
ieee754.read = function (buffer, offset, isLE, mLen, nBytes)

Reference - https://github.com/feross/ieee754

Shivam Mathur
  • 2,543
  • 19
  • 26