msgpack-lite icon indicating copy to clipboard operation
msgpack-lite copied to clipboard

32 bit floating point

Open bQvle opened this issue 7 years ago • 2 comments

Is it possible to encode as 32 bit floating points instead of 64?

I'm sending a lot of floating number over a socket and this seems quiet expensive.

1.1 = [203, 63, 241, 153, 153, 153, 153, 153, 154]

bQvle avatar Jul 15 '18 10:07 bQvle

This is actually correct behaviour because 1.1 is a double-precision float value, which is 64 bits. You can see in the Node REPL:

> Math.fround(1.1)
1.100000023841858

mattbishop avatar Oct 13 '18 17:10 mattbishop

I'd also like to be able to force 32-bit float encoding. Is this possible?

thatcort avatar Aug 22 '19 15:08 thatcort