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

roundup / down Irrational endpoints #33

Open
dlfivefifty opened this issue Aug 1, 2018 · 2 comments
Open

roundup / down Irrational endpoints #33

dlfivefifty opened this issue Aug 1, 2018 · 2 comments

Comments

@dlfivefifty
Copy link
Member

I propose that a .. b should round a down and b up if they are irrational, so that a in a..b and b in a..b is always true. This would fix the following:

julia> π in 0..π
false

julia> π in (0..Float64(π, RoundUp))
true
@hyrodium
Copy link
Collaborator

The following property should also hold, so RoundUp/RoundDown should be optional.

julia> a = 1
1

julia> b = pi
π = 3.1415926535897...

julia> c = 4
4

julia> rightendpoint(a..b) == leftendpoint(b..c)
true

Maybe, defining @correctbounds macro would be helpful?

julia> 0..π
0.0..3.141592653589793

julia> @correctbounds 0..π
0.0..3.1415926535897936

julia> @correctbounds OpenInterval(0,π)
0.0..3.141592653589793

@hyrodium
Copy link
Collaborator

hyrodium commented Aug 1, 2023

Here's another example with Rational

julia> 0.0 .. 1//3
0.0 .. 0.3333333333333333

julia> 1//3 in 0.0 .. 1//3
false

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