Fix AlgebraicNumberPowQQAction corner case#40739
Merged
vbraun merged 2 commits intosagemath:developfrom Feb 11, 2026
Merged
Conversation
|
Documentation preview for this PR (built with commit 90f0cb2; changes) is ready! 🎉 |
6d046a2 to
aa5c925
Compare
Contributor
|
Looks good. Can you merge the newest develop branch? Thank you |
cxzhong
approved these changes
Dec 6, 2025
Member
|
this should be reviewed by number theorists: |
Contributor
|
I left this to others. I do not have some comments now. |
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Feb 5, 2026
sagemathgh-40739: Fix AlgebraicNumberPowQQAction corner case Fixes sagemath#40733. The cause of the linked issue is that `crosses_log_branch_cut() == False` does not imply it's safe to compute `argument()`, since a line crossing zero does not cross the log branch cut, yet its argument is indeterminate. Whether this is the correct definition of the log branch cut is debatable (zero should be included in the branch cut too), but anyway there's another subtle bug in the other branch (just because `val` crosses the branch cut and we know `x` is nonzero (because of the `if not x:` check at the very start) doesn't mean `x` is in fact negative). I just rewrote the logic entirely. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#40739 Reported by: user202729 Reviewer(s): Chenxin Zhong
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Feb 7, 2026
sagemathgh-40739: Fix AlgebraicNumberPowQQAction corner case Fixes sagemath#40733. The cause of the linked issue is that `crosses_log_branch_cut() == False` does not imply it's safe to compute `argument()`, since a line crossing zero does not cross the log branch cut, yet its argument is indeterminate. Whether this is the correct definition of the log branch cut is debatable (zero should be included in the branch cut too), but anyway there's another subtle bug in the other branch (just because `val` crosses the branch cut and we know `x` is nonzero (because of the `if not x:` check at the very start) doesn't mean `x` is in fact negative). I just rewrote the logic entirely. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#40739 Reported by: user202729 Reviewer(s): Chenxin Zhong
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.
Fixes #40733.
The cause of the linked issue is that
crosses_log_branch_cut() == Falsedoes not imply it's safe to computeargument(), since a line crossing zero does not cross the log branch cut, yet its argument is indeterminate.Whether this is the correct definition of the log branch cut is debatable (zero should be included in the branch cut too), but anyway there's another subtle bug in the other branch (just because
valcrosses the branch cut and we knowxis nonzero (because of theif not x:check at the very start) doesn't meanxis in fact negative). I just rewrote the logic entirely.📝 Checklist
⌛ Dependencies