JuliaIntervals / ValidatedNumerics.jl

Rigorous floating-point calculations with interval arithmetic in Julia
Other
85 stars 17 forks source link

empty interval for odds ratio #249

Closed tpapp closed 7 years ago

tpapp commented 7 years ago
julia> using ValidatedNumerics

julia> i = 0..1
[0, 1]

julia> i/(1-i)
[0, ∞]

julia> i = 1..1
[1, 1]

julia> i/(1-i)
∅

I expected ∞..∞ for the last expression, but I may have missed some detail.

tpapp commented 7 years ago

A related issue is log(Interval(0.0)). I wonder if the here is necessary, and whether < would be OK.

dpsanders commented 7 years ago

I believe that these results are mandated by the IEEE 1788 standard document that we (are trying to) follow in the package. Basically, as far as I understand, ∞ is not thought of as a real number, and so intervals like [∞, ∞] are not allowed. (They contain no real number, and so are empty.) cc @lbenet who has studied the standard more carefully.

lbenet commented 7 years ago

Regarding this:

julia> i = 1..1
[1, 1]

julia> i/(1-i)
∅

as @dpsanders explained, the idea is to think the result as the set on real numbers which multiplied by the interval 1-i = Interval(0,0) yields the interval i=Interval(1,1). Since there is no number (nor interval) yielding this, the result must be the empty interval. The same happens with the log. Note that this is due to the fact that 1-i is identical to the (thin) interval Interval(0,0); if you use i=0.5..1.5 you get Interval(-Inf,Inf) as you expected.

dpsanders commented 7 years ago

Since I don't think there's anything we can do here, I'm going to close this.