-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add mod #145
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #145 +/- ##
==========================================
+ Coverage 92.29% 92.46% +0.17%
==========================================
Files 23 23
Lines 1064 1088 +24
==========================================
+ Hits 982 1006 +24
Misses 82 82
Continue to review full report at Codecov.
|
Does this work with e.g. |
No, it doesn't, and actually yields a segmentation fault. Let me take a look on this... |
The problem seems to be that Any idea about how to restrict |
You can do
Or use |
Using |
Maybe the following? julia> x = 7.3..7.3
[7.29999, 7.30001]
julia> y = 5.5..5.5
[5.5, 5.5]
julia> floor(x / y)
[1, 1] |
julia> y = pi..pi
Interval(3.141592653589793, 3.1415926535897936)
julia> x / y
Interval(2.3236621691416715, 2.3236621691416723)
julia> floor(x / y)
Interval(2.0, 2.0) |
I'll certainly test it, since it is simply faster: julia> @btime floor(7.3/5.5)
1.895 ns (0 allocations: 0 bytes)
1.0
julia> @btime fld(7.3, 5.5)
10.660 ns (0 allocations: 0 bytes)
1.0 |
Any update here, @lbenet ? |
Let me rebase to current master and check if everything runs smoothly. |
Rebased to current master and implemented this suggestion. |
Locally, tests pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, thanks! Could you add some tests with mod respect to pi, please?
Thanks for the suggestion. I'll try to add more tests. |
I just pushed few tests involving Yet, I just noticed that the implementation allows to compute |
Tests pass locally. |
But any |
Isn't this basically the same as the issue with quadrants for |
I think it should be something like julia> X = 10..11
[10, 11]
julia> p = pi_interval(Float64)
[3.14159, 3.1416]
julia> division = X / p
[3.18309, 3.50141]
julia> division_floor = floor(division)
[3, 3]
julia> result = (division - division_floor) * p
[0.575222, 1.57523] But sometimes we will have: julia> X = 2p
[6.28318, 6.28319]
julia> X / p
[1.99999, 2.00001] If the For |
You are right. Let me think it over how to implement it. |
This PR addresses #129.