You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to implement // for my own types. The return type would subtype Real and it'd also overload numerator and denominator, but it wouldn't subtype Rational. Would that be allowed?
The motivation is twofold:
(Regular) continued fractions seem to be a good choice for encoding rational numbers. It'd be nice if such a type/package could overload // to return the same type, instead of Rational.
Rational doesn't generally support type domain numbers, because it requires the numerator and denominator to have the same type. Thus a new, "type domain rational", type would be nice, and // would ideally return type domain numbers given type domain numbers as input.
The text was updated successfully, but these errors were encountered:
nsajko
added
docs
This change adds or pertains to documentation
rationals
The Rational type and values thereof
design
Design of APIs or of the language itself
labels
Sep 1, 2024
// can also return Complex, though there are still some overflow issues Ref #53435.
I also find it strange that there is a method of // for //(x::Number, y::Complex) but no method for //(x::Number, y::Real)
I think it might make sense to define a generic //(x::Number, y::Number) = rational(x) / rational(y) where rational would be a function to promote a number to any type that supports exact division.
I want to implement
//
for my own types. The return type would subtypeReal
and it'd also overloadnumerator
anddenominator
, but it wouldn't subtypeRational
. Would that be allowed?The motivation is twofold:
//
to return the same type, instead ofRational
.Rational
doesn't generally support type domain numbers, because it requires the numerator and denominator to have the same type. Thus a new, "type domain rational", type would be nice, and//
would ideally return type domain numbers given type domain numbers as input.The text was updated successfully, but these errors were encountered: