From 664479622d597606534db520a7ee0142c8c526c8 Mon Sep 17 00:00:00 2001 From: Tianyi Pu <44583944+putianyi889@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:29:06 +0000 Subject: [PATCH] Add a docstring for `Base.divgcd` (#53769) Co-authored-by: Sukera <11753998+Seelengrab@users.noreply.github.com> --- base/rational.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/base/rational.jl b/base/rational.jl index b4e450fd73abc..69d39770b2095 100644 --- a/base/rational.jl +++ b/base/rational.jl @@ -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)