Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

OlivierHnt
Copy link

@OlivierHnt OlivierHnt commented Mar 17, 2025

The purpose of this PR is to not call == directly, and use _iszero instead. This is to help integration with IntervalArithmetic.jl since == for our Interval 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 with Interval, since it will return false 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.

Copy link

codecov bot commented Mar 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.08%. Comparing base (f3610c0) to head (974a391).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ViralBShah
Copy link
Member

@SobhanMP

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.

Usage of _iszero, _isnotzero
2 participants