Closed JohnRSim closed 6 years ago
when I encode and then decode I'm not getting expected output..
let a = encode = msgpack.encode, decode = msgpack.decode; const encodePack = encode({"1":0.12}); console.log(decode(encodePack)); //{ '1': 0.11999999731779099 }
Output - { '1': 0.11999999731779099 }
Expected - {"1":0.12}
This is floating point precision issue - because 0.12 cannot be precisely represented in the IEEE754 format - thus it's represented as the value as you see.
this is not a bug.
when I encode and then decode I'm not getting expected output..
Output - { '1': 0.11999999731779099 }
Expected - {"1":0.12}