SpecialFunctions.jl
SpecialFunctions.jl copied to clipboard
`gamma(0)` returns the wrong value.
This issue is the opposite issue of https://github.com/JuliaMath/SpecialFunctions.jl/issues/163. Currently gamma(0.0) returns Inf as does gamma(0.0+0.0im), and gamma(0.0-0.0im) This isn't the correct limit because
gamma(0. + 1e-16im)
0.6123233995736787 - 1.0000000000000034e16im
and
julia> gamma(0.0-1e-16im)
0.6123233995736787 + 1.0000000000000034e16im
which really makes it seem like gamma of complex 0s should return an appropriate complex infinity and gamma(0.0) should error.
Usually for real arguments we take the limit along the real line, with the sign of zero determining the direction of the limit:
julia> gamma(1e-16)
1.0e16
julia> gamma(0.0)
Inf
julia> gamma(-1e-16)
-1.0e16
julia> gamma(-0.0)
-Inf
For a complex 0 possibly we should throw since the limit depends on the angle at which you approach zero?