-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
make Irrational <: AbstractIrrational #24245
Conversation
Can you explain why subtyping |
@nalimilan, what do you mean? Our current |
""" | ||
struct Irrational{sym} <: Real end | ||
abstract type AbstractIrrational <: Real end |
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.
Could be added to the "Abstract number types" section of doc/src/stdlib/numbers.md
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.
Okay, done.
9309e2e
to
ac4ca0f
Compare
Travis failure seems unrelated?
|
Should be unrelated. I wonder why AppVeyor did not run on this? |
Another case where I would like to use this: to define an irrational type with different promotion rules for the ChangePrecision package (see https://discourse.julialang.org/t/change-default-precision/6520/51?u=stevengj). |
ac4ca0f
to
f1862b9
Compare
This ready to merge, @stevengj? |
What would now be the minimal interface/set of methods that a new subtype of |
I created a new issue for "Next steps/guidelines for AbstractIrrational" (#26550) |
As I mentioned in #24238, adding new irrational types, e.g. to represent exact multiples of π, would be vastly easier if we had
Irrational <: AbstractIrrational <: Real
rather thanIrrational <: Real
, because most of the methods for promotion etc. would be shared with the existingIrrational
type.This is a pretty simple change that I think we should make immediately.