X Tutup
Skip to content

Make definition of Float type clear#200

Merged
frsyuki merged 1 commit intomsgpack:masterfrom
frsyuki:master
Dec 22, 2015
Merged

Make definition of Float type clear#200
frsyuki merged 1 commit intomsgpack:masterfrom
frsyuki:master

Conversation

@frsyuki
Copy link
Copy Markdown
Member

@frsyuki frsyuki commented Jun 15, 2015

MessagePack type system has not defined error margin of Float type.
A clear thing is that the type system does not distinguish
single-precision from double-precision and double-precision is the
finest precision.
However, some applications need to be aware about precision especially
when they compare a serialized floating point numbers with values
comming from other data sources.
This change makes it clear that MessagePack type system does not
preserve size of error margin, and it uses IEEE 754 double-precision.

MessagePack type system has not defined error margin of Float type.
A clear thing is that the type system does not distinguish
single-precision from double-precision and double-precision is the
finest precision.
However, some applications need to be aware about precision especially
when they compare a serialized floating point numbers with values
comming from other data sources.
This change makes it clear that MessagePack type system does not
preserve size of error margin, and it uses IEEE 754 double-precision.
@tagomoris
Copy link
Copy Markdown
Member

Doesn't this spec include any SHOULD or RECOMMENDED to handle Float type in each implementations?
(to use double in default, or so)

@vsergeev
Copy link
Copy Markdown

@frsyuki, Do you mean that every Float32/Float64 should be deserialized into a double-precision Float, and every double-precision Float should be serialized into the smallest representation (Float32 or Float64) that retains the precision of that value?

Also, what do you mean by define an "error margin" of the Float type? Error between a more compact Float32 representation and the Float64 representation of the same value?

Finally, I'm not sure I understand your comment:

However, some applications need to be aware about precision especially
when they compare a serialized floating point numbers with values
comming from other data sources.

That seems to imply that the serialization should preserve the application's intended precision for a data type, e.g. if it was serialized as Float32, then it should be deserialized as a single-precision float.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup