Skip to content

Commit b1f954c

Browse files
authored
update // docstring (#52050)
The `//` operator supports non-real numbers, so updating the docstring would be helpful.
1 parent fae6b78 commit b1f954c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

base/rational.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ end
4747
//(num, den)
4848
4949
Divide two integers or rational numbers, giving a [`Rational`](@ref) result.
50+
More generally, `//` can be used for exact rational division of other numeric types
51+
with integer or rational components, such as complex numbers with integer components.
52+
53+
Note that floating-point ([`AbstractFloat`](@ref)) arguments are not permitted by `//`
54+
(even if the values are rational).
55+
The arguments must be subtypes of [`Integer`](@ref), `Rational`, or composites thereof.
5056
5157
# Examples
5258
```jldoctest
@@ -55,6 +61,13 @@ julia> 3 // 5
5561
5662
julia> (3 // 5) // (2 // 1)
5763
3//10
64+
65+
julia> (1+2im) // (3+4im)
66+
11//25 + 2//25*im
67+
68+
julia> 1.0 // 2
69+
ERROR: MethodError: no method matching //(::Float64, ::Int64)
70+
[...]
5871
```
5972
"""
6073
//(n::Integer, d::Integer) = Rational(n,d)

0 commit comments

Comments
 (0)