-
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
Simplified version of mod(x::Interval, y::Real) #525
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
fea1b34
Introduce simplified version of mod
petvana 153d749
Improve testing
petvana d23df89
Update src/intervals/functions.jl
petvana b56f4be
Use ⊇ operator
petvana ea00b23
Imrpove test coverage + use zero()
petvana ff47910
Add todo for mod with between two intervals
petvana 45abc46
Implementation for strictly negative divisors for mod
petvana d2603d6
Update docs
petvana 439723f
Disable divisor for mod to be an interval
petvana 6fdc809
Merge branch 'simplified-mod' of github.com:petvana/IntervalArithmeti…
petvana f9f4733
Throw ArgumentError for Interval divisor for mod
petvana 7bef23e
Cleanup
petvana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
an alternative would be to return an empty interval, I think this would be more conformant with the IEEE standard behavior, e.g.
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.
Or we can define
mod(a..b, 0) == 0..0 ⊇ ∅
as Wolfram sayshttps://www.wolframalpha.com/input?i=limit+x-%3E0%2B+mod%281%2C+x%29
Consequently, for
0 ∈ y
, we can define smth likemod(x,y) = union(mod(x,(y.lo..y.lo/3)), mod(x, (y.hi/3)..(y.hi)))
because the maximum value needs to by in(y.hi/2)..(y.hi)
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.
I propose to solve this in some future PR, and move the discussion to #129, to keep track once this PR merged.
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.
Julia (and Wolfram) return
NaN
(undefined
) formod(3.2, 0.0)
, which makes sense due to the division in the algorithm.This idea is interesting, and reminds me a little bit what we have for
extended_div
. That certainly should be addressed in another PR. Yet, I think for (mathematical) reals,mod(x,y)
is a number in the interval [0,y] for y>0, or [y, 0] if y<0, isn't it?From the range of
mod(x,y)
for realy
, then for a strictly positive intervaly
, we should return[0, sup(y)]
, or if it is strictly negative[inf(y), 0]
. If0 ∈ y
, we should return the hull of these intervals.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.
I think my last comment corresponds to these results... Or not?