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(1..2, 3..4) crashes Julia #182

Closed
dpsanders opened this issue Jul 17, 2018 · 4 comments · Fixed by #567
Closed

Interval(1..2, 3..4) crashes Julia #182

dpsanders opened this issue Jul 17, 2018 · 4 comments · Fixed by #567
Labels

Comments

@dpsanders
Copy link
Member

[Mistake for IntervalBox.]

@dpsanders
Copy link
Member Author

On 0.6; IA on Julia 0.7 is currently broken.

@Kolaru
Copy link
Collaborator

Kolaru commented Jul 18, 2018

It seems to be a display issue:

julia> Interval(1..2, 3..4)
Error showing value of type IntervalArithmetic.Interval{IntervalArithmetic.Interval{Float64}}:
ERROR: StackOverflowError:

julia> setformat(:full)
6

julia> Interval(1..2, 3..4)
Interval(Interval(1.0, 2.0), Interval(3.0, 4.0))

It doesn't crash the REPL for me (Julia 0.6.4 on Windows) thought.

The StackOverflowError probably means there is an infinite recursive call somewhere, I will try to hunt it down.

@Kolaru
Copy link
Collaborator

Kolaru commented Jul 19, 2018

The crash comes from here:

round_string(x::Real, digits::Int, r::RoundingMode) = round_string(big(x), digits, r)

If x is an Interval, it is a real as well, but big(x) is still an interval. Therefore big(x) never becomes a BigFloat which is needed to switch to another method, hence the infinite recursion.

However, we should probably not silently accept something like Interval(1..2, 3..4)... we could be lenient and return an IntervalBox, which would be very misleading, but works fine, or we could just return an error.

Interestingly enough, this boils down to the fact that since Intervals (and others) are Real we can not assume that Real only means the Integer, Float and BigFloat families, which is related to #181.

@dpsanders
Copy link
Member Author

Thanks for finding the problem!

I think this should just give an error.

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