diff --git a/src/gamma.jl b/src/gamma.jl index c0cb034d..e34d21da 100644 --- a/src/gamma.jl +++ b/src/gamma.jl @@ -439,7 +439,7 @@ function _zeta(s::ComplexOrReal{Float64}) lg = loggamma(1 - s) rehalf = real(s)*0.5 return zeta(1 - s) * exp(lg + absim*halfπ + s*log2π) * inv2π * Complex( - sinpi(rehalf), copysign(cospi(rehalf), imag(s)) + sinpi(rehalf), flipsign(cospi(rehalf), imag(s)) ) else return zeta(1 - s) * gamma(1 - s) * sinpi(s*0.5) * twoπ^s * invπ diff --git a/src/gamma_inc.jl b/src/gamma_inc.jl index c57f474f..04a3de0c 100644 --- a/src/gamma_inc.jl +++ b/src/gamma_inc.jl @@ -670,7 +670,7 @@ function gamma_inc_temme_1(a::Float64, x::Float64, z::Float64, ind::Integer) l = x/a y = -a * LogExpFunctions.logmxp1(l) if a*eps()*eps() > 3.28e-3 - throw(DomainError((a, x, ind_), "P(a,x) or Q(a,x) is computationally indeterminant in this case.")) + throw(DomainError((a, x, ind), "P(a,x) or Q(a,x) is computationally indeterminant in this case.")) end c = exp(-y) w = 0.5*erfcx(sqrt(y)) diff --git a/test/gamma.jl b/test/gamma.jl index 15cd4716..7497410e 100644 --- a/test/gamma.jl +++ b/test/gamma.jl @@ -266,6 +266,12 @@ end @test 1e-10 > relerr(zeta(.4 + 4053.0im), -0.1248993234383550+0.9195498409364987im) @test 1e-13 > relerr(zeta(.4 + 12.01im), 1.0233184799021265846512208845-0.8008078492939259287905322251im) @test zeta(.4 + 12.01im) == conj(zeta(.4 - 12.01im)) + + # issue #420 + @test zeta(-2+13im) ≅ conj(zeta(-2-13im)) ≅ -0.30019019877262619754737023564024299182018857012958761814433485-5.5583626885487917197617298283836431070419020764882132809770386im + @test zeta(-6+13im) ≅ conj(zeta(-6-13im)) ≅ 133.4764526350263089084083707864441932569167866714712267139316498-54.15465727586582149098585229287107039070546786014930791081909684im + @test 1e-12 > relerr(zeta(-2+13im, 3), 2.3621038290867825837364823054-3.9497600485207119519185591345im) + @test 1e-12 > relerr(zeta(-2-13im, 3), 2.3621038290867825837364823054+3.9497600485207119519185591345im) end @testset "logabsbinomial" begin