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

Option to write 32-bit floats when possible #234

Merged
merged 2 commits into from
Apr 23, 2021

Conversation

jobarr-amzn
Copy link
Contributor

This allows the Ion binary writer to write a double value with only 32 bits for the number instead of 64 wherever this is losslessly possible.

Issue #, if available: Referenced in #139.

Description of changes: Add an option to specify a compact floats preference, and corresponding tests.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

This allows the Ion binary writer to write a `double` value with only
32 bits for the number instead of 64 wherever this is losslessly
possible.
tgregg
tgregg previously approved these changes Apr 23, 2021
Copy link
Contributor

@tgregg tgregg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

// 0100 0000 1000 0110 0110 0110 0110 0110
// 4 0 8 6 6 6 6 6
test_ion_binary_writer_supports_compact_floats(TRUE, truncated, "\xE0\x01\x00\xEA\x44\x40\x86\x66\x66", 9);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline.

@jobarr-amzn jobarr-amzn merged commit 8b1b571 into amazon-ion:master Apr 23, 2021
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