Skip to content

Commit

Permalink
Add a docstring for Base.divgcd (#53769)
Browse files Browse the repository at this point in the history
Co-authored-by: Sukera <[email protected]>
  • Loading branch information
putianyi889 and Seelengrab authored Nov 7, 2024
1 parent 910bf7e commit 6644796
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions base/rational.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ Rational(n::T, d::T) where {T<:Integer} = Rational{T}(n, d)
Rational(n::Integer, d::Integer) = Rational(promote(n, d)...)
Rational(n::Integer) = unsafe_rational(n, one(n))

"""
divgcd(x::Integer, y::Integer)
Returns `(x÷gcd(x,y), y÷gcd(x,y))`.
See also [`div`](@ref), [`gcd`](@ref).
"""
function divgcd(x::TX, y::TY)::Tuple{TX, TY} where {TX<:Integer, TY<:Integer}
g = gcd(uabs(x), uabs(y))
div(x,g), div(y,g)
Expand Down

0 comments on commit 6644796

Please sign in to comment.