float: preserve NaN sign when propagating NaNs - #1239
Open
HuzaifaAbdulRehman wants to merge 1 commit into
Open
Conversation
Author
|
Hi @tgross35, this has been open for a couple weeks with all 44 checks passing and no conflicts with main. Happy to make any changes if you'd like a different approach, just let me know. Thanks for taking a look when you get a chance. |
Contributor
|
Yeah sorry, I have seen this but have been a bit backed up for reviews, it may be another week or two since we've come across some higher priority things. As a quick note, it looks like your PR description may be machine-generated; please rewrite it, all communication with humans needs to be handwritten. Also the title should be more specific, this is only touches addition (similarly, it shouldn't close the linked issue). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1188.
Soft-float addition classified NaNs using sign-stripped representations and then reused those representations to construct the result. This discarded the sign bit when propagating an input NaN.
Use the original operand representation when setting the quiet bit, preserving the input sign and payload while quieting signaling NaNs. This also matches the corresponding compiler-rt behavior.
The regression tests check signaling and quiet NaNs in both operand positions for
f16,f32,f64, andf128. They fail againstmainwith sign-stripped results and pass with this change.Validation:
cargo +nightly test -p builtins-test --test addsub --no-default-features -j 1cargo +nightly test --workspace --no-default-features --exclude musl-math-sys -j 1cargo +nightly fmt --all -- --checkgit diff --checkThe unexcluded workspace command requires the musl source fixture, which is not present in this shallow checkout.
AI assistance: I used OpenAI Codex to assist with investigation, implementation, and validation. I reviewed the changes and test results.