-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace v == zero(v)
with _iszero
#610
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #610 +/- ##
=======================================
Coverage 84.08% 84.08%
=======================================
Files 12 12
Lines 9192 9192
=======================================
Hits 7729 7729
Misses 1463 1463 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
You're right not to change those checks and why. They are actually necessary for correctness in the case of Intervals, too! For example, with I'm happy to merge this PR but hesitant to mark it for back porting because of how many edge cases sparse arrays tend to have. I'm not opposed to someone else backporting if they are more confidant than I that there won't be unintended consequences. |
Thanks for reviewing the PR. Indeed we must be cautious with such changes. SparseArrays.jl/src/sparsematrix.jl Line 2443 in 2420351
I might be overlooking something, but it seems that these 6 instances of using |
For folks considering backporting, the semantic changes here are, AFAICT:
The latter could theoretically break things, though that seems implausible. I'm not opposed to another maintainer choosing to backport. |
@LilithHafner Thanks for reviewing this! |
The purpose of this PR is to not call
==
directly, and use_iszero
instead. This is to help integration with IntervalArithmetic.jl since==
for ourInterval
type does not always return a Boolean.Closes #609.
I did not change two checks using
===
since this would break the behaviour for-0.0
. If I understood correctly, it should not be an issue withInterval
, since it will returnfalse
consistently (it may be sub-optimal, but not wrong)cc @dpsanders, @Kolaru
cc also @kalmarek, since you raised JuliaIntervals/IntervalArithmetic.jl#628 you may have more experience mixing SparseArrays and IntervalArithmetic
I do not know how to the backporting procedure works, but it'd be great to have this for 1.10 and 1.11.