Skip to content

Commit 11fd77b

Browse files
committed
Allow calling stirlings1 and stirlings2 with Integer arguments
This allows to call them with `BigInt` arguments to avoid overflow. Closes JuliaMath#104.
1 parent e005ee0 commit 11fd77b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/numbers.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,12 @@ function lucasnum(n::Integer)
125125
return z[]
126126
end
127127

128-
function stirlings1(n::Int, k::Int, signed::Bool=false)
128+
"""
129+
stirlings1(n::Integer, k::Integer)
130+
131+
Compute the Stirling number of the first kind, `s(n,k)`.
132+
"""
133+
function stirlings1(n::Integer, k::Integer, signed::Bool=false)
129134
if signed == true
130135
return (-1)^(n - k) * stirlings1(n, k)
131136
end
@@ -152,11 +157,11 @@ function stirlings1(n::Int, k::Int, signed::Bool=false)
152157
end
153158

154159
"""
155-
stirlings2(n::Int, k::Int)
160+
stirlings2(n::Integer, k::Integer)
156161
157162
Compute the Stirling number of the second kind, `S(n,k)`.
158163
"""
159-
function stirlings2(n::Int, k::Int)
164+
function stirlings2(n::Integer, k::Integer)
160165
if n < 0
161166
throw(DomainError(n, "n must be nonnegative"))
162167
elseif n == k == 0

0 commit comments

Comments
 (0)