Skip to content

Select the principal branch of complex acosh in both half-planes - #1436

Draft
agourakis82 wants to merge 1 commit into
xtensor-stack:masterfrom
agourakis82:fix/complex-acosh-principal-branch-1432
Draft

agourakis82 wants to merge 1 commit into
xtensor-stack:masterfrom
agourakis82:fix/complex-acosh-principal-branch-1432

Conversation

@agourakis82

Copy link
Copy Markdown

Complex acosh selects the wrong branch for inputs in the lower half-plane. For example, (2, -1) produces approximately (-1.46935, 0.507356) instead of (1.46935, -0.507356).

Construct the result from the nonnegative imaginary magnitude of acos(z) and apply the sign of the input imaginary component to the output imaginary component. Add mixed-lane float/double coverage in both half-planes, checking the scalar C++ reference, branch signs, and recovery through cosh.

Validation:

  • Apple Clang, C++23, ARM64: the identical new test fails before the fix (192 assertions), then the full complex-hyperbolic test unit passes (4 cases, 576 assertions).
  • ASan/UBSan and -ffast-math: the same test unit passes.
  • Native GCC 13.3, C++23, SSE2 and AVX2: before/after regressions confirmed; the complete complex-hyperbolic test unit passes on both.
  • The unchanged original issue reproducer now passes its three nonzero-negative-imaginary acosh examples.
  • Formatting and whitespace checks pass.

Addresses the lower-half-plane acosh examples in #1432. The real-axis magnitude defect inherited from acos, other inverse-function defects, nonfinite inputs, and complete architecture coverage remain outside this patch. No claim that #1432 is fully resolved.

This branch has not been deployed

No deployments
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