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

Subtle case of type instability in convert #291

Closed
lbenet opened this issue Jun 13, 2019 · 9 comments
Closed

Subtle case of type instability in convert #291

lbenet opened this issue Jun 13, 2019 · 9 comments

Comments

@lbenet
Copy link
Member

lbenet commented Jun 13, 2019

A subtle case of type instability:

julia> R = Interval{BigFloat}
Interval{BigFloat}

julia> convert(R, 1.1)
[1.09999, 1.10001]₂₅₆

julia> typeof(ans)  # this is ok
Interval{BigFloat}

julia> convert(R, Inf)
[1.79769e+308, ∞]

julia> typeof(ans)  # this is wrong!
Interval{Float64}
@dpsanders
Copy link
Member

Oops...

cc @yashrajgupta

@lbenet
Copy link
Member Author

lbenet commented Jun 13, 2019

The following gives the correct type but the result is quite different than the one above

julia> R(Inf)
[∞, ∞]₂₅₆

julia> typeof(ans)
Interval{BigFloat}

@dpsanders
Copy link
Member

That is a bug that I think is reported in an issue: [Inf, Inf] is not a valid interval.

@dpsanders
Copy link
Member

I guess that's because we removed error checking from the constructor... Maybe that was a bad idea and we should put it back in? We need to benchmark it though.

@lbenet
Copy link
Member Author

lbenet commented Jun 13, 2019

I agree, I think we should also have a set of benchmarks to note if such changes help or not, exploiting BenchmarkTools.jl

@vtjnash
Copy link

vtjnash commented Aug 9, 2019

FWIW, this is why the tests don't pass on v1.2+

@dpsanders
Copy link
Member

Fixed by #315

@dpsanders
Copy link
Member

Thanks for the report @lbenet and for pointing out the failing tests @vtjnash !

@lbenet
Copy link
Member Author

lbenet commented Aug 9, 2019

Thanks for fixing it!

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

3 participants