Repository navigation
Handle zero and infinite argument pairs in atan2 - #1439
Draft
agourakis82 wants to merge 2 commits into
Draft
agourakis82 wants to merge 2 commits into
agourakis82 wants to merge 2 commits into
Conversation
This branch has not been deployed
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.
atan2forms an invalid ratio when both inputs are zero or both are infinite, producing NaN angles instead of the signed zero/pi or quadrant angle required for those pairs. The zero case also giveslog(0 +/- 0i)a NaN imaginary component.Use safe temporary division operands for these pairs. Preserve the original signs for zero-pair selection and let the existing quadrant calculation handle the unit ratio for infinite pairs. Add mixed-lane float/double coverage for zero pairs, infinite pairs, axes, ordinary quadrants, single-infinite controls, NaN propagation and complex
logat signed zeros. Nonzero angles are compared numerically; zero values and their signs are checked exactly.Validation (C++23):
4bc84b2(60 assertions); the expanded affected units pass with the final patch (10 cases / 732 assertions). ASan/UBSan passes the same units.4bc84b2(120 assertions), then pass with the final patch (10 cases / 1464 assertions). CPU-only Slurm20310 completed with exit0:0.FE_INVALIDorFE_DIVBYZERO; the preceding implementation returns NaN and raises flags for infinite pairs. No general exception-freedom claim for other inputs.log1p(-1 +/- 0i). This PR remains independently based on master; Preserve the imaginary zero sign in complex log1p #1438 preserves the imaginary sign duringlog1ptranslation.4bc84b2also passed ARM64, ASan/UBSan, translated SSE2 and native AVX2. Current expanded counts above refer to the additional infinite-pair coverage.Related to the endpoint found while investigating #1432. Exceptional-pair handling is excluded under fast-math; infinity coverage is guarded when infinities/NaNs are disabled. Broader overflow, underflow, nonfinite accuracy, a full-suite pass and all-architecture validation remain outside this patch.