Repository navigation
Use IsZero instead of comparing with 0*x in the library - #6708
Merged
Merged
Conversation
Replace checks of the form `x = 0*x`, `x <> 0*x` and `x = 0*y` by `IsZero( x )`. This is shorter, avoids building a zero object just for the comparison, and lets representations with a dedicated `IsZero` method use it. Assisted-by: Claude Code (Opus 5.5)
james-d-mitchell
approved these changes
Oct 8, 2026
james-d-mitchell
left a comment
Contributor
There was a problem hiding this comment.
Looks like a good change to me
fingolfin
approved these changes
Oct 8, 2026
Member
|
CI fails, strange: |
Contributor
|
I've seen this recently in the ci for Semigroups also, which I think is unrelated to the changes in this pr. I'll try to post the link when I'm back at my computer |
Contributor
So, here's the related failure in the Semigroups CI: https://github.com/semigroups/Semigroups/actions/runs/37783273881/job/113331490255?pr=1235 from The error is identical to the one @fingolfin reported here. |
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.
Replace 40 checks of the form
x = 0*x,x <> 0*xorx = 0*yin the library byIsZero( x ).IsZerois shorter and avoids building a zero object just for the comparison. Its generic method does the sameelm = 0*elmcomparison, and some representations have faster methods.🤖 Created with the help of Claude Code (Opus 5.5)