Repository navigation
Preserve real-axis branches in complex asin and acos - #1437
Draft
agourakis82 wants to merge 1 commit into
Draft
agourakis82 wants to merge 1 commit into
agourakis82 wants to merge 1 commit 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.
Complex
asindiscards the imaginary component on the real-axis branch outside[-1, 1]and returns a positive real component for negative arguments. This also gives incorrect results inacos, which is defined throughasin.For example,
asin(2 + 0i)returns approximately(1.5708, 0)instead of(1.5708, 1.31696), whileasin(-4 + 0i)returns a positive half-pi instead of a negative one. Restore the signed real component and the imaginary magnitude using realacosh, with the branch side selected by the imaginary zero. Preserve the input imaginary zero inside[-1, 1]. Clamp the realacoshargument to its domain in lanes where that branch is discarded.Add mixed-lane float/double regressions for
asinandacos: both imaginary-zero signs, signed real zero, interior points, endpoints, adjacent values outside the endpoints, and off-axis controls. Comparisons use scalar C++ complex functions, with exact zero/sign assertions where applicable.Validation (C++23):
asin/acoscases and its imaginary-axisasinhexamples.acosh(2 - 0i)example. This PR is independently based on master; theacoshbranch selection remains in Select the principal branch of complex acosh in both half-planes #1436.Addresses part of #1432. Large off-axis cancellation/overflow, nonfinite inputs, and complete architecture coverage remain outside this patch. The new signed-zero assertions are disabled under fast-math; no fast-math signed-zero guarantee or full-suite pass is claimed. Floating-point exception freedom is not claimed: the clamp preserves the baseline
FE_INVALIDstate for a focused interior-axis witness, including a pre-existing floatFE_INVALIDflag.