-
Notifications
You must be signed in to change notification settings - Fork 883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot serialize small floats in msgpack float format #1111
Comments
It is intentional design. See #1070 and #1017.
We don't assume certain source type. If you want to enforce float packing, you can create PR for that. msgpack-c/include/msgpack/v1/pack.hpp Lines 821 to 828 in e9e06a5
It always use MessagePack 64bit signed integer format even if the value is not require 64bit. Similarlly, you can add Test code locations are after msgpack-c/test/msgpack_basic.cpp Lines 148 to 200 in e9e06a5
and msgpack-c/test/msgpack_basic.cpp Lines 238 to 294 in e9e06a5
|
Bug description
I stumbled over #1018, since I was not expecting my float values to be serialized as int64.
Furthermore, there currently does not seem to be a way to force serialization of a float to the float msgpack format.
I find this a bit inconsistent API-wise, because there's
pack_fix_int32
(and others) for integers, which does force a certain serialization width.Version: msgpack-cxx 6.1.0, but the problem is probably present since cpp-4.1.2.
Regarding the spec, I interpreted the following such that for "an object of a certain source type, serializers SHOULD use the format among the formats for that specific source type which represents the data in the smallest number of bytes."
To Reproduce
Expected behavior
I want to be able to pack a float in the msgpack float representation.
This is also maybe related to #1070.
The text was updated successfully, but these errors were encountered: