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

interval(-Inf) should do the useful thing #688

Closed
dpsanders opened this issue Oct 14, 2024 · 6 comments
Closed

interval(-Inf) should do the useful thing #688

dpsanders opened this issue Oct 14, 2024 · 6 comments

Comments

@dpsanders
Copy link
Member

julia> interval(-Inf)
┌ Warning: ill-formed interval [a, b] with a = -Inf, b = -Inf and decoration d = com. NaI is returned
└ @ IntervalArithmetic ~/Dropbox/packages/IntervalArithmetic/src/intervals/construction.jl:446
∅_ill

IMO This should return -Inf..(nextfloat(-Inf)) instead

@OlivierHnt
Copy link
Member

Our hands are tied by the standard on interval arithmetic on this. Indeed, the only current flavour supported by IntervalArithmetic.jl is the "set based flavour" which states that $\infty$ can never be part of an interval.

If I recall correctly (to check), what you want is the behaviour described by the "c-set flavour", which is not currently implemented. I am closing this issue as it is the desired result. Note, we could open an issue about implementing the "c-set flavour" (though we may lack the man power at the moment to tackle this).

@dpsanders
Copy link
Member Author

dpsanders commented Oct 14, 2024

I would argue that -Inf is the representation in floating point for "any number smaller than typemin(Float64)". The correct result for interval(-Inf) should then be "the smallest floating-point interval containing that number", which would be -Inf..(nextfloat(-Inf)).

I don't believe the standard says anything about this case?

@OlivierHnt
Copy link
Member

For this we have to look at the IEEE Standard for Floating-Point Arithmetic (IEEE Std 754-2019, page 48):

The behavior of infinity in floating-point arithmetic is derived from the limiting cases of real arithmetic
with operands of arbitrarily large magnitude, when such a limit exists. Infinities shall be interpreted in the
affine sense, that is: $-\infty < \text{every finite number} < +\infty$.

@dpsanders
Copy link
Member Author

OK fair enough I guess, thanks!

@dpsanders
Copy link
Member Author

dpsanders commented Oct 14, 2024 via email

@OlivierHnt
Copy link
Member

Yes

julia> typemax(Interval{Float64})
[1.79769e+308, ∞)_dac

julia> typemin(Interval{Float64})
(-∞, -1.79769e+308]_dac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants