Skip to content

Commit be73d81

Browse files
fredrikekreKeno
authored andcommitted
fix typo in gamma ccall, fix #101 (#102)
1 parent 1485740 commit be73d81

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/gamma.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ lbeta(x::Number, w::Number) = lgamma(x)+lgamma(w)-lgamma(x+w)
714714
function gamma(x::BigFloat)
715715
isnan(x) && return x
716716
z = BigFloat()
717-
ccall((:mpfr_lgamma, :libmpfr), Int32, (Ref{BigFloat}, Ref{BigFloat}, Int32), z, x, ROUNDING_MODE[])
717+
ccall((:mpfr_gamma, :libmpfr), Int32, (Ref{BigFloat}, Ref{BigFloat}, Int32), z, x, ROUNDING_MODE[])
718718
isnan(z) && throw(DomainError(x, "NaN result for non-NaN input."))
719719
return z
720720
end

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,11 @@ end
520520
@test typeof(SF.erf(a)) == BigFloat
521521
@test typeof(SF.erfc(a)) == BigFloat
522522
end
523+
524+
# issue #101
525+
for i in 0:5
526+
@test gamma(big(i)) == gamma(i)
527+
end
523528
end
524529

525530
@testset "Base Julia issue #17474" begin

0 commit comments

Comments
 (0)