Skip to content

Commit

Permalink
attach binomial(n::Integer, k::Integer) method to docstring (JuliaLan…
Browse files Browse the repository at this point in the history
…g#56679)

Slight tweak to JuliaLang#54307: attach the `binomial(n::Integer, k::Integer)`
method to the corresponding docstring, rather than the narrower
`binomial(n::T, k::T) where {T<:Integer}` method.
  • Loading branch information
stevengj authored Nov 26, 2024
1 parent 7df1dfa commit ea82538
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion base/intfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,8 @@ julia> binomial(-5, 3)
# External links
* [Binomial coefficient](https://en.wikipedia.org/wiki/Binomial_coefficient) on Wikipedia.
"""
binomial(n::Integer, k::Integer) = binomial(promote(n, k)...)

Base.@assume_effects :terminates_locally function binomial(n::T, k::T) where T<:Integer
n0, k0 = n, k
k < 0 && return zero(T)
Expand Down Expand Up @@ -1233,7 +1235,6 @@ Base.@assume_effects :terminates_locally function binomial(n::T, k::T) where T<:
end
copysign(x, sgn)
end
binomial(n::Integer, k::Integer) = binomial(promote(n, k)...)

"""
binomial(x::Number, k::Integer)
Expand Down

0 comments on commit ea82538

Please sign in to comment.