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

Document isapprox #675

Open
dpsanders opened this issue Jul 28, 2024 · 3 comments
Open

Document isapprox #675

dpsanders opened this issue Jul 28, 2024 · 3 comments
Labels
1.0 Planned for the major 1.0 release doc

Comments

@dpsanders
Copy link
Member

julia> isapprox(1..2, 3..4)
ERROR: ArgumentError: `==` is purposely not supported for intervals. See instead `isequal_interval`
Stacktrace:
 [1] ==(x::Interval{Float64}, y::Interval{Float64})
   @ IntervalArithmetic ~/Dropbox/packages/IntervalArithmetic/src/intervals/real_interface.jl:86
 [2] #isapprox#809
   @ ./floatfuncs.jl:308 [inlined]
 [3] isapprox(x::Interval{Float64}, y::Interval{Float64})
   @ Base ./floatfuncs.jl:304
 [4] top-level scope
   @ REPL[3]:1

This should either work or fail with a sensible error message.

@OlivierHnt OlivierHnt changed the title isapprox errors Document isapprox Jul 31, 2024
@OlivierHnt OlivierHnt added 1.0 Planned for the major 1.0 release doc labels Jul 31, 2024
@OlivierHnt
Copy link
Member

There is a section in the documentation Comparisons and set operations whose first sentence reads "All comparisons and set operations for Real have been purposely disallowed to prevent silent errors".

We should explicitly mention isapprox there.

@dpsanders
Copy link
Member Author

Sorry I meant that isapprox has not been explicitly disallowed - we haven't defined it (to error) for intervals. It's falling back to a generic definition in base as far as I can see.

@OlivierHnt
Copy link
Member

Actually it was disallowed on purpose. We currently just rely on a fallback error.
This is the case for several other functions, eg symdiff or intersect, etc. (see intersect(interval(1, 2), interval(1, 2))).

That being said, I am not opposed to customise the error message eventually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0 Planned for the major 1.0 release doc
Projects
None yet
Development

No branches or pull requests

2 participants