Skip to content
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

Clarification: floating point minimal representation #322

Open
leocencetti opened this issue Nov 10, 2022 · 0 comments
Open

Clarification: floating point minimal representation #322

leocencetti opened this issue Nov 10, 2022 · 0 comments

Comments

@leocencetti
Copy link

leocencetti commented Nov 10, 2022

The section about type-to-format conversion in the spec states the following:

If an object can be represented in multiple possible output formats, serializers SHOULD use the format which represents the data in the smallest number of bytes.

The wording makes it unclear whether the set of "multiple possible output formats" is limited to the scope of the value type.

For example, let's assume we want to serialize the following C variable:

double value = 70.0;

Now, what should the serializer do?

  1. Serialize the value as float32 instead of the full precision float64
  2. Serialize the value as fixint since 70.0 == 70

According to the quoted extract, both approaches might seem valid.

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

No branches or pull requests

1 participant