JuliaIntervals / IntervalArithmetic.jl

Library for validated numerics using interval arithmetic
https://juliaintervals.github.io/IntervalArithmetic.jl/
Other
297 stars 71 forks source link

Document `in` behaviour #647

Open dpsanders opened 4 months ago

dpsanders commented 4 months ago
julia> 3.5 ∈ interval(3, 4)
false

This should either work or give me an error message telling me that this is not supported for intervals and telling me which special interval function to use instead (which is not discoverable).

dpsanders commented 4 months ago

Apparently it's in_interval

OlivierHnt commented 4 months ago

I took the freedom of re-naming this issue since this behaviour is intentional and has been extensively discussed. In a nutshell, in Julia the function in pertains to containers (which Interval is not); we cannot remove it completely (throw an error) for otherwise some generic functions fail, we cannot overload it with our own definition since this leads to silent errors in generic code.

We should highlight this in the docs, and maybe just add a docstring for in?