Skip to content

Commit f39248d

Browse files
authored
upper incomplete gamma function Γ(a,z) (#271)
* clarify gamma_inc docs and make ind=0 the default, rm incorrect method that converted all Integer (even BigInt) to Float64 * add gamma(a,x) * more promotion fixes * gamma docs and cross-refs * more promotion tweaks * use inc=0 default parameter in gamma_inc tests * more fixes and tests * more tests * doc typo * rm unused method * add more tests and infinity handling * whoops, move tests out of loop
1 parent db0ee77 commit f39248d

File tree

5 files changed

+159
-53
lines changed

5 files changed

+159
-53
lines changed

docs/src/functions_list.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ SpecialFunctions.ellipk
5555
SpecialFunctions.ellipe
5656
SpecialFunctions.eta
5757
SpecialFunctions.zeta
58-
SpecialFunctions.gamma
58+
SpecialFunctions.gamma(::Number)
59+
SpecialFunctions.gamma(::Number,::Number)
5960
SpecialFunctions.gamma_inc
6061
SpecialFunctions.gamma_inc_inv
6162
SpecialFunctions.beta_inc

docs/src/functions_overview.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ Here the *Special Functions* are listed according to the structure of [NIST Digi
55
## [Gamma Function](https://dlmf.nist.gov/5)
66
| Function | Description |
77
|:-------- |:----------- |
8-
| [`gamma(z)`](@ref SpecialFunctions.gamma) | [gamma function](https://en.wikipedia.org/wiki/Gamma_function) ``\Gamma(z)`` |
8+
| [`gamma(z)`](@ref SpecialFunctions.gamma(::Number)) | [gamma function](https://en.wikipedia.org/wiki/Gamma_function) ``\Gamma(z)`` |
99
| [`digamma(x)`](@ref SpecialFunctions.digamma) | [digamma function](https://en.wikipedia.org/wiki/Digamma_function) (i.e. the derivative of `lgamma` at `x`) |
1010
| [`invdigamma(x)`](@ref SpecialFunctions.invdigamma) | [invdigamma function](http://bariskurt.com/calculating-the-inverse-of-digamma-function/) (i.e. inverse of `digamma` function at `x` using fixed-point iteration algorithm) |
1111
| [`trigamma(x)`](@ref SpecialFunctions.trigamma) | [trigamma function](https://en.wikipedia.org/wiki/Trigamma_function) (i.e the logarithmic second derivative of `gamma` at `x`) |
1212
| [`polygamma(m,x)`](@ref SpecialFunctions.polygamma) | [polygamma function](https://en.wikipedia.org/wiki/Polygamma_function) (i.e the (m+1)-th derivative of the `lgamma` function at `x`) |
13+
| [`gamma(a,z)`](@ref SpecialFunctions.gamma(::Number,::Number)) | [upper incomplete gamma function ``\Gamma(a,z)``](https://en.wikipedia.org/wiki/Incomplete_gamma_function) |
1314
| [`gamma_inc(a,x,IND)`](@ref SpecialFunctions.gamma_inc) | [incomplete gamma function ratio P(a,x) and Q(a,x)](https://en.wikipedia.org/wiki/Incomplete_gamma_function) (i.e evaluates P(a,x) and Q(a,x)for accuracy specified by IND and returns tuple (p,q)) |
1415
| [`beta_inc(a,b,x,y)`](@ref SpecialFunctions.beta_inc) | [incomplete beta function ratio Ix(a,b) and Iy(a,b)](https://en.wikipedia.org/wiki/Beta_function#Incomplete_beta_function) (i.e evaluates Ix(a,b) and Iy(a,b) and returns tuple (p,q)) |
1516
| [`gamma_inc_inv(a,p,q)`](@ref SpecialFunctions.gamma_inc_inv) | [inverse of incomplete gamma function ratio P(a,x) and Q(a,x)](https://en.wikipedia.org/wiki/Incomplete_gamma_function) (i.e evaluates x given P(a,x)=p and Q(a,x)=q |

src/gamma.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,6 @@ export gamma, loggamma, logabsgamma, beta, logbeta, logabsbeta, logfactorial, lo
573573
gamma(x::Float64) = nan_dom_err(ccall((:tgamma, libm), Float64, (Float64,), x), x)
574574
gamma(x::Float32) = nan_dom_err(ccall((:tgammaf, libm), Float32, (Float32,), x), x)
575575
gamma(x::Float16) = Float16(gamma(Float32(x)))
576-
gamma(x::Real) = gamma(float(x))
577576
gamma(x::AbstractFloat) = throw(MethodError(gamma, x))
578577

579578
function gamma(x::BigFloat)
@@ -606,15 +605,17 @@ External links:
606605
[DLMF](https://dlmf.nist.gov/5.2.1),
607606
[Wikipedia](https://en.wikipedia.org/wiki/Gamma_function).
608607
609-
See also: [`loggamma(z)`](@ref SpecialFunctions.loggamma).
608+
See also: [`loggamma(z)`](@ref SpecialFunctions.loggamma) for ``\log \Gamma(z)`` and
609+
[`gamma(a,z)`](@ref SpecialFunctions.gamma(::Number,::Number)) for
610+
the upper incomplete gamma function ``\\Gamma(a,z)``.
610611
611612
# Implementation by
612613
- `Float`: C standard math library
613614
[libm](https://en.wikipedia.org/wiki/C_mathematical_functions#libm).
614615
- `Complex`: by `exp(loggamma(z))`.
615616
- `BigFloat`: C library for multiple-precision floating-point [MPFR](https://www.mpfr.org/)
616617
"""
617-
gamma
618+
gamma(x::Number) = gamma(float(x))
618619

619620
function logabsgamma(x::Float64)
620621
signp = Ref{Int32}()

src/gamma_inc.jl

Lines changed: 80 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ end
818818
# doi>10.1145/22721.23109
819819

820820
"""
821-
gamma_inc(a,x,IND)
821+
gamma_inc(a,x,IND=0)
822822
823823
Returns a tuple ``(p, q)`` where ``p + q = 1``, and
824824
``p=P(a,x)`` is the Incomplete gamma function ratio given by:
@@ -829,14 +829,19 @@ and ``q=Q(a,x)`` is the Incomplete gamma function ratio given by:
829829
```math
830830
Q(x,a)=\\frac{1}{\\Gamma (a)} \\int_{x}^{\\infty} e^{-t}t^{a-1} dt.
831831
```
832+
In terms of these, the lower incomplete gamma function is
833+
``\\gamma(a,x) = P(a,x) \\Gamma(a)`` and the upper incomplete
834+
gamma function is ``\\Gamma(a,x) = Q(a,x) \\Gamma(a)``.
832835
833836
`IND ∈ [0,1,2]` sets accuracy: `IND=0` means 14 significant digits accuracy, `IND=1` means 6 significant digit, and `IND=2` means only 3 digit accuracy.
834837
835838
External links: [DLMF](https://dlmf.nist.gov/8.2.4), [Wikipedia](https://en.wikipedia.org/wiki/Incomplete_gamma_function)
836839
837840
See also [`gamma(z)`](@ref SpecialFunctions.gamma), [`gamma_inc_inv(a,p,q)`](@ref SpecialFunctions.gamma_inc_inv)
838841
"""
839-
function gamma_inc(a::Float64,x::Float64,ind::Integer)
842+
gamma_inc(a::Real,x::Real,ind::Integer=0) = _gamma_inc(promote(float(a),float(x))...,ind)
843+
844+
function _gamma_inc(a::Float64,x::Float64,ind::Integer)
840845
iop = ind + 1
841846
acc = acc0[iop]
842847
if a<0.0 || x<0.0
@@ -933,17 +938,14 @@ function gamma_inc(a::Float64,x::Float64,ind::Integer)
933938

934939
end
935940

936-
function gamma_inc(a::BigFloat,x::BigFloat,ind::Integer) #BigFloat version from GNU MPFR wrapped via ccall
941+
function _gamma_inc(a::BigFloat,x::BigFloat,ind::Integer) #BigFloat version from GNU MPFR wrapped via ccall
937942
z = BigFloat()
938943
ccall((:mpfr_gamma_inc, :libmpfr), Int32 , (Ref{BigFloat} , Ref{BigFloat} , Ref{BigFloat} , Int32) , z , a , x , ROUNDING_MODE[])
939944
q = z/gamma(a)
940945
return (1.0 - q, q)
941946
end
942-
gamma_inc(a::Float32,x::Float32,ind::Integer) = ( Float32(gamma_inc(Float64(a),Float64(x),ind)[1]) , Float32(gamma_inc(Float64(a),Float64(x),ind)[2]) )
943-
gamma_inc(a::Float16,x::Float16,ind::Integer) = ( Float16(gamma_inc(Float64(a),Float64(x),ind)[1]) , Float16(gamma_inc(Float64(a),Float64(x),ind)[2]) )
944-
gamma_inc(a::Real,x::Real,ind::Integer) = (gamma_inc(float(a),float(x),ind))
945-
gamma_inc(a::Integer,x::Integer,ind::Integer) = gamma_inc(Float64(a),Float64(x),ind)
946-
gamma_inc(a::AbstractFloat,x::AbstractFloat,ind::Integer) = throw(MethodError(gamma_inc,(a,x,ind,"")))
947+
_gamma_inc(a::Float32,x::Float32,ind::Integer) = Float32.(_gamma_inc(Float64(a),Float64(x),ind))
948+
_gamma_inc(a::Float16,x::Float16,ind::Integer) = Float16.(_gamma_inc(Float64(a),Float64(x),ind))
947949

948950
#EFFICIENT AND ACCURATE ALGORITHMS FOR THECOMPUTATION AND INVERSION OF THE INCOMPLETEGAMMA FUNCTION RATIOS by Amparo Gil, Javier Segura, Nico M. Temme
949951
#SIAM Journal on Scientific Computing 34(6) (2012), A2965-A2981
@@ -958,7 +960,9 @@ External links: [DLMF](https://dlmf.nist.gov/8.2.4), [Wikipedia](https://en.wiki
958960
959961
See also: [`gamma_inc(a,x,ind)`](@ref SpecialFunctions.gamma_inc).
960962
"""
961-
function gamma_inc_inv(a::Float64, p::Float64, q::Float64)
963+
gamma_inc_inv(a::Real, p::Real, q::Real) = _gamma_inc_inv(promote(float(a), float(p), float(q))...)
964+
965+
function _gamma_inc_inv(a::Float64, p::Float64, q::Float64)
962966
if p < 0.5
963967
pcase = true
964968
porq = p
@@ -1028,8 +1032,70 @@ function gamma_inc_inv(a::Float64, p::Float64, q::Float64)
10281032
return x
10291033
end
10301034

1031-
gamma_inc_inv(a::Float32, p::Float32, q::Float32) = Float32( gamma_inc_inv(Float64(a), Float64(p), Float64(q)) )
1032-
gamma_inc_inv(a::Float16, p::Float16, q::Float16) = Float16( gamma_inc_inv(Float64(a), Float64(p), Float64(q)) )
1033-
gamma_inc_inv(a::Real, p::Real, q::Real) = ( gamma_inc_inv(float(a), float(p), float(q)) )
1034-
gamma_inc_inv(a::Integer, p::Integer, q::Integer) = ( gamma_inc_inv(Float64(a), Float64(p), Float64(q)) )
1035-
gamma_inc_inv(a::AbstractFloat, p::AbstractFloat, q::AbstractFloat) = throw(MethodError(gamma_inc_inv,(a,p,q,"")))
1035+
_gamma_inc_inv(a::Float32, p::Float32, q::Float32) = Float32(_gamma_inc_inv(Float64(a), Float64(p), Float64(q)))
1036+
_gamma_inc_inv(a::Float16, p::Float16, q::Float16) = Float16(_gamma_inc_inv(Float64(a), Float64(p), Float64(q)))
1037+
1038+
# like promote(x,y), but don't complexify real values
1039+
promotereal(x::Real,y::Real) = promote(x,y)
1040+
promotereal(x::Real,y::Number) = let (u,v) = promote(x,y); real(u),v; end
1041+
promotereal(x::Number,y::Real) = let (u,v) = promote(x,y); u,real(v); end
1042+
promotereal(x,y) = promote(x,y)
1043+
1044+
"""
1045+
gamma(a,x)
1046+
1047+
Returns the upper incomplete gamma function
1048+
```math
1049+
\\Gamma(a,x) = \\int_x^\\infty t^{a-1} e^{-t} dt \\, ,
1050+
```
1051+
supporting arbitrary real or complex `a` and `x`.
1052+
1053+
(The ordinary gamma function [`gamma(x)`](@ref) corresponds to ``\\Gamma(a) = \\Gamma(a,0)``.
1054+
See also the [`gamma_inc`](@ref) function to compute both the upper and lower
1055+
(``\\gamma(a,x)``) incomplete gamma functions scaled by ``\\Gamma(a)``.
1056+
1057+
External links: [DLMF](https://dlmf.nist.gov/8.2.2), [Wikipedia](https://en.wikipedia.org/wiki/Incomplete_gamma_function)
1058+
"""
1059+
gamma(a::Number,x::Number) = _gamma(promotereal(float(a),float(x))...)
1060+
gamma(a::Integer,x::Number) = _gamma(a, float(x))
1061+
1062+
function _gamma(a::Number,x::Number)
1063+
if a isa Real && x isa Real && !isfinite(a*x)
1064+
if isinf(x) && isfinite(a)
1065+
if x > 0 # == +Inf
1066+
return one(a)*zero(x)
1067+
elseif a > 0 && isinteger(a) # x == -Inf
1068+
return one(a)*x # -Inf
1069+
end
1070+
elseif isinf(a) && isfinite(x)
1071+
if a > 0
1072+
if x 0
1073+
return a*one(x) # +Inf
1074+
else
1075+
throw(DomainError((a,x), "gamma will only return a complex result if called with a complex argument"))
1076+
end
1077+
elseif a < 0
1078+
return zero(a)*one(x)
1079+
end
1080+
end
1081+
end
1082+
return iszero(x) ? one(x)*gamma(a) : x^a * expint(1-a, x)
1083+
end
1084+
1085+
_gamma(a::Integer, x::BigFloat) = _gamma_big(a, x)
1086+
_gamma(a::BigInt, x::Real) = _gamma_big(a, x)
1087+
_gamma(a::BigInt, x::BigFloat) = _gamma_big(a, x)
1088+
_gamma(a::BigFloat,x::BigFloat) = _gamma_big(a, x)
1089+
function _gamma_big(a::Real,x::Real)
1090+
if x < 0
1091+
# MPFR returns NaN in this case
1092+
if isinteger(a) && a > 0
1093+
return invoke(_gamma, Tuple{Number,Number}, a, BigFloat(x))
1094+
else
1095+
throw(DomainError((a,x), "gamma will only return a complex result if called with a complex argument"))
1096+
end
1097+
end
1098+
z = BigFloat()
1099+
ccall((:mpfr_gamma_inc, :libmpfr), Int32 , (Ref{BigFloat} , Ref{BigFloat} , Ref{BigFloat} , Int32) , z , a , x , ROUNDING_MODE[])
1100+
return z
1101+
end

test/gamma_inc.jl

Lines changed: 71 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
@testset "incomplete gamma ratios" begin
22
#Computed using Wolframalpha gamma(a,x)/gamma(a) ~ gamma_q(a,x,0) function.
3-
@test gamma_inc(10,10,0)[2] 0.45792971447185221
4-
@test gamma_inc(1,1,0)[2] 0.3678794411714423216
5-
@test gamma_inc(0.5,0.5,0)[2] 0.31731050786291410
6-
@test gamma_inc(BigFloat(30.5),BigFloat(30.5),0)[2] parse(BigFloat,"0.47591691193354987004") rtol=eps()
7-
@test gamma_inc(5.5,0.5,0)[2] 0.9999496100513121669
8-
@test gamma_inc(0.5,7.4,0)[2] 0.0001195355018130302
9-
@test gamma_inc(0.5,0.22,0)[2] 0.507122455359825146
10-
@test gamma_inc(0.5,0.8,0)[2] 0.20590321073206830887
11-
@test gamma_inc(11.5,0.5,0)[2] 0.999999999998406112
12-
@test gamma_inc(0.19,0.99,0)[2] 0.050147247342905857
13-
@test gamma_inc(0.9999,0.9999,0)[2] 0.3678730556923103
14-
@test gamma_inc(24,23.9999999999,0)[2] 0.472849720555859138
15-
@test gamma_inc(0.5,0.55,0)[2] 0.29426610430496289
16-
@test gamma_inc(Float32(0.5),Float32(0.55),0)[2] Float32(gamma_inc(0.5,0.55,0)[2])
17-
@test gamma_inc(Float16(0.5),Float16(0.55),0)[2] Float16(gamma_inc(0.5,0.55,0)[2])
18-
@test gamma_inc(30,29.99999,0)[2] 0.475717712451705704
19-
@test gamma_inc(30,29.9,0)[2] 0.482992166284958565
20-
@test gamma_inc(10,0.0001,0)[2] 1.0000
21-
@test gamma_inc(0.0001,0.0001,0)[2] 0.000862958131006599
22-
@test gamma_inc(0.0001,10.5,0)[1] 0.999999999758896146
23-
@test gamma_inc(1,1,0)[1] 0.63212055882855768
24-
@test gamma_inc(13,15.1,0)[2] 0.25940814264863701
25-
@test gamma_inc(0.6,1.3,0)[2] 0.136458554006505355
26-
@test gamma_inc((100),(80),0)[2] 0.9828916869648668
3+
@test gamma_inc(10,10)[2] 0.45792971447185221
4+
@test gamma_inc(1,1)[2] 0.3678794411714423216
5+
@test gamma_inc(0.5,0.5)[2] 0.31731050786291410
6+
@test gamma_inc(BigFloat(30.5),BigFloat(30.5))[2] parse(BigFloat,"0.47591691193354987004") rtol=eps()
7+
@test gamma_inc(5.5,0.5)[2] 0.9999496100513121669
8+
@test gamma_inc(0.5,7.4)[2] 0.0001195355018130302
9+
@test gamma_inc(0.5,0.22)[2] 0.507122455359825146
10+
@test gamma_inc(0.5,0.8)[2] 0.20590321073206830887
11+
@test gamma_inc(11.5,0.5)[2] 0.999999999998406112
12+
@test gamma_inc(0.19,0.99)[2] 0.050147247342905857
13+
@test gamma_inc(0.9999,0.9999)[2] 0.3678730556923103
14+
@test gamma_inc(24,23.9999999999)[2] 0.472849720555859138
15+
@test gamma_inc(0.5,0.55)[2] 0.29426610430496289
16+
@test gamma_inc(Float32(0.5),Float32(0.55))[2] Float32(gamma_inc(0.5,0.55)[2])
17+
@test gamma_inc(Float16(0.5),Float16(0.55))[2] Float16(gamma_inc(0.5,0.55)[2])
18+
@test gamma_inc(30,29.99999)[2] 0.475717712451705704
19+
@test gamma_inc(30,29.9)[2] 0.482992166284958565
20+
@test gamma_inc(10,0.0001)[2] 1.0000
21+
@test gamma_inc(0.0001,0.0001)[2] 0.000862958131006599
22+
@test gamma_inc(0.0001,10.5)[1] 0.999999999758896146
23+
@test gamma_inc(1,1)[1] 0.63212055882855768
24+
@test gamma_inc(13,15.1)[2] 0.25940814264863701
25+
@test gamma_inc(0.6,1.3)[2] 0.136458554006505355
26+
@test gamma_inc((100),(80))[2] 0.9828916869648668
2727
@test gamma_inc((100),(80),1)[2] 0.9828916869
2828
@test Float16(gamma_inc((100),(80),2)[2]) Float16(.983)
29-
@test gamma_inc(13.5,15.1,0)[2] 0.305242642543419087
30-
@test gamma_inc(11,9,0)[1] 0.2940116796594881834
31-
@test gamma_inc(8,32,0)[1] 0.99999989060651042057
32-
@test gamma_inc(15,16,0)[2] 0.3675273597655649298
33-
@test gamma_inc(15.5,16,0)[2] 0.4167440299455427811
34-
@test gamma_inc(0.9,0.8,0)[1] 0.59832030278768172
35-
@test gamma_inc(1.7,2.5,0)[1] 0.78446115627678957
36-
@test gamma_inc(11.1,0.001,0)[2] 1.0000
37-
@test gamma_inc(1e7, (1e7)+1, 0)[1] 0.5001682088254367
38-
@test gamma_inc(1e7, (1e7)+1, 0)[2] 0.4998317911745633
29+
@test gamma_inc(13.5,15.1)[2] 0.305242642543419087
30+
@test gamma_inc(11,9)[1] 0.2940116796594881834
31+
@test gamma_inc(8,32)[1] 0.99999989060651042057
32+
@test gamma_inc(15,16)[2] 0.3675273597655649298
33+
@test gamma_inc(15.5,16)[2] 0.4167440299455427811
34+
@test gamma_inc(0.9,0.8)[1] 0.59832030278768172
35+
@test gamma_inc(1.7,2.5)[1] 0.78446115627678957
36+
@test gamma_inc(11.1,0.001)[2] 1.0000
37+
@test gamma_inc(1e7, (1e7)+1)[1] 0.5001682088254367
38+
@test gamma_inc(1e7, (1e7)+1)[2] 0.4998317911745633
3939
@test_throws DomainError gamma_inc(-1,2,2)
4040
@test_throws DomainError gamma_inc(0,0,1)
4141
end
@@ -63,3 +63,40 @@ end
6363
@test SpecialFunctions.stirling(x) log(gamma(x)) - (x-.5)*log(x)+x- log(2*pi)/2.0
6464
end
6565
end
66+
67+
double(x::Real) = Float64(x)
68+
double(x::Integer) = Int(x)
69+
double(x::Complex) = ComplexF64(x)
70+
71+
@testset "upper incomplete gamma function" begin
72+
setprecision(BigFloat, 256) do
73+
for a in Any[0:0.4:3; 1:3], x in 0:0.2:2
74+
@test gamma(a,x) gamma(big(a),big(x))
75+
end
76+
@test_throws DomainError gamma(-2.2, -1.3)
77+
for (a,x, exact) in (
78+
(2, big"+1.3", big"0.6268231239782289871813662853957039889809398944861850589869804057956189274569818"),
79+
(2, big"-1.3", big"-1.100789000285773266137246974803445875429455665367265440176867948378982424804222"),
80+
(big"2.2", big"1.3", big"0.7550934853735524106456916078787596171599416239996064979513848803118671763945577"),
81+
(big"-2.2", big"1.3", big"0.03938564959393195337328006806473296774233286427565465045140458665248322893076784"),
82+
(big"-2.2", big"-1.3"+0im, Complex(big"0.1688350167695890519002747177035271528716667324397453142169971691104641885370081", big"-1.724677939954414412829215929952389349929001266936564849801773346878175589599461")),
83+
(2, big"1.3"+2im, Complex(big"0.2347744561498965806069446787000456827042253434143074251879541754828136789074293", big"-0.7967951407674886396960561446265346226800340382780520672369163777061700801594228")),
84+
(big"2.2", big"1.3"+2im, Complex(big"0.4226969694490623767886715572749155659150206342283251276656790859161308520476838", big"-0.9507541450333763666696561254491461255244463810462729822382144498284499948680099")),
85+
(big"2.2"-2im, big"1.3"+2im, Complex(big"-3.858698824275578861673404086439928163791926530897603434146764316225759116935376", big"0.2105970967650200831829566202893410569725743566037534990454186505024476246014339")),
86+
(30, big"-1e2", big"-2.080142496354742431762923569133534773079637504483999408076147454085194055640495e+101"),
87+
)
88+
if !(exact isa Complex) # we don't yet have a Complex{BigFloat} gamma function
89+
@test gamma(a, x) exact atol=eps(abs(exact))*1000
90+
end
91+
@test gamma(double(a), double(x)) double(exact) rtol=1e-13
92+
end
93+
end
94+
@test gamma(30, big(-1000)) big"-1.914496653187781420578078670260160511219745144309147121829045802464973219500799e+521" rtol=1e-70
95+
@test gamma(30, -1000) == -Inf
96+
@test gamma(Inf, 51.2) == Inf
97+
@test gamma(-Inf, -51.2) == 0.0
98+
@test_throws DomainError gamma(Inf, -51.2)
99+
@test gamma(2.3, Inf) == 0.0
100+
@test gamma(2, -Inf) == -Inf
101+
@test_throws DomainError gamma(2.2, -Inf)
102+
end

0 commit comments

Comments
 (0)