msgpack-c
msgpack-c copied to clipboard
Unable to deserialize and display float value
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
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