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

Rethink .. #345

Closed
dpsanders opened this issue Dec 16, 2019 · 9 comments · Fixed by #567
Closed

Rethink .. #345

dpsanders opened this issue Dec 16, 2019 · 9 comments · Fixed by #567

Comments

@dpsanders
Copy link
Member

dpsanders commented Dec 16, 2019

I believe this has been raised before, but I think a..b should no longer do "magic" rounding.

Apart from the performance aspect, this is to bring this usage into line with that of IntervalSets.jl, ApproxFun.jl etc. Then we can depend on / interoperate with IntervalSets.jl instead of being in conflict with them.

If a user wants the magic rounding, they should use the macros: the string macro or @interval:

julia> I"0.1..0.2"
[0.0999999, 0.100001]

julia> @interval(0.1, 0.2)
[0.0999999, 0.200001]

We should allow @interval 0.1..0.2 too.

cc @lbenet @Kolaru

@Kolaru
Copy link
Collaborator

Kolaru commented Dec 16, 2019

This would make a .. b an alias of Interval(a, b), which seems very reasonnable, so I'm in favor of this.

@dpsanders
Copy link
Member Author

Yes, or rather interval(a, b) (the version with checking).

@lbenet
Copy link
Member

lbenet commented Dec 17, 2019

I agree, as long as there is a simple way of getting rounding correctly. I do think that what makes IntervalArithmetic special, is the correct rounding.

@lbenet
Copy link
Member

lbenet commented Dec 17, 2019

Mmmm, isn't #347 precisely the opposite to JuliaMath/IntervalSets.jl#33? In any case, I agree that we should share the meaning of alike symbols.

@dpsanders
Copy link
Member Author

No, that's what Sheehan was saying in that issue if I'm not mistaken? That it should round up the irrational (but currently doesn't).

@lbenet
Copy link
Member

lbenet commented Dec 17, 2019

I agree with what you say; but if we follow the suggestion discussed here, 0.. pi will not round up. Or do we want also to make an exception with irrationals?

@dpsanders
Copy link
Member Author

Well, it's not exactly an exception: We have to round them either down or up, so let's choose the one that actually includes the irrational!

@lbenet
Copy link
Member

lbenet commented Dec 17, 2019

But can't you actually argue the same for 0 .. 0.1?

@dpsanders
Copy link
Member Author

No, because 0.1 is a well-defined exact floating-point number.

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

Successfully merging a pull request may close this issue.

3 participants