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

Always serialize NaN without sign #7

Merged
merged 1 commit into from
Oct 27, 2023
Merged

Always serialize NaN without sign #7

merged 1 commit into from
Oct 27, 2023

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Oct 27, 2023

In all likelihood, the sign of NaNs is not meaningful in the user's program. rust-lang/rfcs#3514 (comment): "by and large nobody cares about the sign of a NaN". It would usually just be surprising and undesirable for -nan to appear in output serialized by this crate, when the sign of the NaN was not intentionally controlled by the caller, or may even be nondeterministic if it comes from arithmetic operations or a cast.

In toml-lang/toml#506 (comment) it sounds like the motivation for TOML supporting -nan was a Robustness Principle "be liberal in what you accept from others" without the intention that TOML emitters would ever produce it.

This crate will continue to deserialize -nan as a negative NaN.

@dtolnay dtolnay merged commit 282d008 into master Oct 27, 2023
17 checks passed
@dtolnay dtolnay deleted the unsignednan branch October 27, 2023 17:09
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.

1 participant