Skip to content

Commit

Permalink
fix typo in gamma ccall, fix JuliaMath#101
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Jun 24, 2018
1 parent 1485740 commit 1b12460
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/gamma.jl
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ lbeta(x::Number, w::Number) = lgamma(x)+lgamma(w)-lgamma(x+w)
function gamma(x::BigFloat)
isnan(x) && return x
z = BigFloat()
ccall((:mpfr_lgamma, :libmpfr), Int32, (Ref{BigFloat}, Ref{BigFloat}, Int32), z, x, ROUNDING_MODE[])
ccall((:mpfr_gamma, :libmpfr), Int32, (Ref{BigFloat}, Ref{BigFloat}, Int32), z, x, ROUNDING_MODE[])
isnan(z) && throw(DomainError(x, "NaN result for non-NaN input."))
return z
end
Expand Down
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,11 @@ end
@test typeof(SF.erf(a)) == BigFloat
@test typeof(SF.erfc(a)) == BigFloat
end

# issue #101
for i in 0:5
@test gamma(big(i)) == gamma(i)
end
end

@testset "Base Julia issue #17474" begin
Expand Down

0 comments on commit 1b12460

Please sign in to comment.