Skip to content

Commit f48db8e

Browse files
replicate gamma(0.0) and gamma(-0.0) behaviour
Here it's possible to tell which of +Inf and -Inf to use
1 parent 98eab44 commit f48db8e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/confluent.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ Compute Kummer's confluent hypergeometric function `M(a, b, z) = ₁F₁(a; b; z
66
function _₁F₁(a, b, z; kwds...)
77
if isequal(a, b) # 13.6.1
88
return exp(z)
9-
elseif -b
9+
elseif -b
1010
if -a ℕ₀ && real(a) real(b)
1111
return _₁F₁maclaurin(a, b, z; kwds...)
1212
else
13-
return throw(DomainError(b, "M(a, b, z) = ₁F₁(a; b; z) is not defined for nonpositive integer b unless a is also a nonpositive integer and a ≥ b."))
13+
return throw(DomainError(b, "M(a, b, z) = ₁F₁(a; b; z) is not defined for negative integer b unless a is a nonpositive integer and a ≥ b."))
1414
end
1515
elseif -a ℕ₀
1616
return _₁F₁maclaurin(a, b, z; kwds...)

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,8 @@ end
466466
@testset "M" begin
467467
@test M(-3, -3, 0.5) exp(0.5)
468468
@test M(0, -1, 10) 1.0
469+
@test M(1.2, 0.0, 0.1) == Inf # Mimick gamma( 0.0) = Inf
470+
@test M(1.2, -0.0, 0.1) == -Inf # and gamma(-0.0) = -Inf
469471
@test_throws DomainError M(1, -2, 0.5)
470472
@test_throws DomainError M(-3, -2, 0.5)
471473
@test M(-2, -3, 0.5) 1.375

0 commit comments

Comments
 (0)