File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -490,7 +490,7 @@ The first and most basic definition just makes `a ⊘ b` construct a `OurRationa
490
490
is already a rational number, we construct a new rational for the resulting ratio slightly differently;
491
491
this behavior is actually identical to division of a rational with an integer.
492
492
Finally, applying
493
- ` ⊘ ` to complex integral values creates an instance of ` Complex{OurRational} ` -- a complex
493
+ ` ⊘ ` to complex integral values creates an instance of ` Complex{<: OurRational} ` -- a complex
494
494
number whose real and imaginary parts are rationals:
495
495
496
496
``` jldoctest rational
@@ -499,12 +499,12 @@ julia> z = (1 + 2im) ⊘ (1 - 2im);
499
499
julia> typeof(z)
500
500
Complex{OurRational{Int64}}
501
501
502
- julia> typeof(z) <: Complex{OurRational}
503
- false
502
+ julia> typeof(z) <: Complex{<: OurRational}
503
+ true
504
504
```
505
505
506
506
Thus, although the ` ⊘ ` operator usually returns an instance of ` OurRational ` , if either
507
- of its arguments are complex integers, it will return an instance of ` Complex{OurRational} ` instead.
507
+ of its arguments are complex integers, it will return an instance of ` Complex{<: OurRational} ` instead.
508
508
The interested reader should consider perusing the rest of [ ` rational.jl ` ] ( https://github.com/JuliaLang/julia/blob/master/base/rational.jl ) :
509
509
it is short, self-contained, and implements an entire basic Julia type.
510
510
You can’t perform that action at this time.
0 commit comments