-
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
[RFC] rethink rational intervals #495
Comments
Do we know of any usage for rational intervals? Your proposition comes down to effectively dropping support them. So that would be quite breaking if anyone is using them. Otherwise, I don't see much reason to keep them. And they indeed make the code base harder to maintain. |
I guess that's the main question here. The fact that nobody had reported #470 may be an indicator that not many people are using those? Alternatively there are people using rational intervals for application where they can assume they only need arithmetic operations and all intervals will always be bounded. I don't think we have a way to find out, except maybe asking in |
I was looking into contributing to the 1.0-dev branch and was wondering about the restriction @lucaferranti what is the feeling here? In particular with respect to the 1.0-dev branch. |
I was thinking about having rational intervals in the packaging and in this issue I am drafting a proposal I would very like to hear feedback/comments about
Idea
Remove
Interval{Rational{T}} where T
and update the constructor so that for exampleInterval(1//2)
orInterval(1//2..2//3)
would convert that interval to float (of course properly, that is rounding down the lower bound and rounding up the upper bound and for 1-input constructor ensuring that the interval contains the true rational number (see #405))Grounds for the proposal
Interval{Rational}
#470 ), here is the showcaseThe reason for this is that the use of
1//0
and-1//0
asInf
and-Inf
in the floating point sense is kind of limited, e.g.Currently, some operations return NaN (e.g. midpoint of emptyinterval, or inf and sup of NaI ), and there is no NaN equivalent for Rational. It is true that
Rational
type is not mentioned in the standard and we could do what we want, but it feels quite difficult to maintain a code that would have a different behavior forInterval{<:Rational}
andInterval{<:AbstractFloat}
. see nai() not working with rational intervals #462Looking at
subtypes(Real)
the change could allow to change the definition of Interval to
Interval{T<:AbstractFloat}
, I think this could simplify some conversion rules and avoid method ambiguity that may arise fromInterval <: Real
that sometimes pops up. This I guess could come at the price of making Intervals with custom types (there was an issue about this) unusable.That's just a few ideas to discuss. I am tagging people I presume may be interested in participating in the discussion, I apologize in advance if I bother despite you are not interested and I apologize even more to those that may be interested and I didn't think to tag.
cc: @dpsanders @Kolaru @lbenet
The text was updated successfully, but these errors were encountered: