Closed thephoenixofthevoid closed 5 years ago
https://github.com/mcollina/msgpack5/blob/827ed095d6f18ed52e7f4ddafe498e1e6d0a6a77/lib/encoder.js#L314
const fround = Math.fround; function encodeFloat (obj, forceFloat64) { var buf if (forceFloat64 || !fround || fround(obj) !== obj) { buf = Buffer.allocUnsafe(9) buf[0] = 0xcb buf.writeDoubleBE(obj, 1) } else { buf = Buffer.allocUnsafe(5) buf[0] = 0xca buf.writeFloatBE(obj, 1) } return buf }
Would you like to send a PR?
I would better include this one into that big PR, if that's ok. When done refactoring decoder, I will do it.
https://github.com/mcollina/msgpack5/blob/827ed095d6f18ed52e7f4ddafe498e1e6d0a6a77/lib/encoder.js#L314