JuliaIntervals / IntervalArithmetic.jl

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

Unclear error for malformed interval #645

Closed dpsanders closed 4 months ago

dpsanders commented 4 months ago
julia> interval.(SVector(3, 4), SVector(1, 3))
┌ Warning: invalid interval, NaI is returned
└ @ IntervalArithmetic ~/Dropbox/packages/IntervalArithmetic/src/intervals/construction.jl:444
┌ Warning: invalid interval, NaI is returned
└ @ IntervalArithmetic ~/Dropbox/packages/IntervalArithmetic/src/intervals/construction.jl:444
2-element SVector{2, Interval{Float64}} with indices SOneTo(2):
 ∅_ill
 ∅_ill

It's initially unclear what's going on here. It would be great to improve the error message to say something like

 The interval `interval(a, b)` with `(a, b) = (3, 1)` is not well-formed, since `a > b`