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

Unable to deserialize and display float value

Open nobody93 opened this issue 6 years ago • 1 comments

Hi,

I have a message with float attribute packeted by a C++ class using MSGPACK_DEFINE_MAP, after serialize it, writing to a binary file, I can see the file size is increasing compared to the same object but the attribute using integer. But when I read the binary file back, deserialize it, display it by: msgpack::unpacked upd; msgpack::unpack(upd, buffer.str().data(), buffer.str().size()); std::cout << upd.get() << std::endl;

All fractions are lost, only integer displayed. What I could be missing?

Thank you.

jupiter

nobody93 avatar Feb 19 '19 03:02 nobody93

I think that you need to check the contents of the binary file.

Here is MessagePack float family binary format: https://github.com/msgpack/msgpack/blob/master/spec.md#float-format-family

redboltz avatar Feb 19 '19 04:02 redboltz