You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are currently working on releasing the 1.0 version of IntervalArithmetic.jl (see JuliaIntervals/IntervalArithmetic.jl#698). One important decision we made is to be very strict with the usage of boolean comparison functions from Base. For instance, iszero(x::Interval) throws if x contains zero but is not thin, like $[-1, 1]$.
I noticed that you have two internal functions _iszero and _isnotzero which seems to be used only in the context "is the number exactly zero".
I found (on 1.11, but maybe also true on 1.10) that this is not used everywhere, e.g.
Is it possible to replace all instances of x == zero(x) (and similar) with _iszero (or _isnotzero) ? If so, could this be backported to 1.10 and 1.11 as well?
I expect that you'll need to return missing or IntervalArithmatic.Unknown() or some such or declare a weak dependency on SpareArrays because iszero(x) === true still throws if iszero(x) throws.
Thanks for having a look at this issue. We do have SparseArrays as a weak dependency for the tentative 1.0 (JuliaIntervals/IntervalArithmetic.jl#698) which uses the _iszero and _isnotzero hooks.
Activity
ViralBShah commentedon Mar 16, 2025
Should be ok in principle. Are you able to put a PR?
SobhanMP commentedon Mar 17, 2025
I think it's probably worth reading the comments in #296, in short beware that -0 is a bit weird.
OlivierHnt commentedon Mar 17, 2025
Thx for the heads up 🙂. I'll make a PR, we can discuss the backporting procedure then.
Replace `v == zero(v)` with `_iszero` (#610)
LilithHafner commentedon Mar 26, 2025
I expect that you'll need to return
missingorIntervalArithmatic.Unknown()or some such or declare a weak dependency on SpareArrays becauseiszero(x) === truestill throws ifiszero(x)throws.OlivierHnt commentedon Mar 26, 2025
Thanks for having a look at this issue. We do have SparseArrays as a weak dependency for the tentative 1.0 (JuliaIntervals/IntervalArithmetic.jl#698) which uses the
_iszeroand_isnotzerohooks.Replace `v == zero(v)` with `_iszero` (#610)
Base.iszeronot fully compatible usingIntervalArithmeticvalues #667 as a duplicate of this issue