We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tanpi
NaN
Current definition of tanpi produces NaN for large complex argument. For example,
julia> tanpi(500 * exp(im * 3pi/4)) NaN + NaN*im
The reason is that sinpi and cospi produce Inf with this argument,
sinpi
cospi
Inf
julia> sinpi(500 * exp(im * 3pi/4)) Inf + Inf*im julia> cospi(500 * exp(im * 3pi/4)) Inf - Inf*im
while tanpi is defined as
julia/base/special/trig.jl
Line 943 in 0163991
This NaN causes NaN in some special functions. For example,
julia> using SpecialFunctions julia> digamma(500 * exp(im * 3pi/4)) NaN + NaN*im
See the related issue in SpecialFunctions.jl repo for details.
SpecialFunctions.jl
Inspired by how cotpi is defined in mpmath: https://github.com/mpmath/mpmath/blob/5e57cb8039a3a4c9f222901a5eb2e08c53b2b2f8/mpmath/libfp.py#L153-L161 I suggest defining tanpi as
cotpi
tanpi(x::Complex) = imag(x) > 10 ? 1.0im : imag(x) < 10 ? -1.0im : sinpi(x) / cospi(x)
This issue is copied from #28943 (comment).
The text was updated successfully, but these errors were encountered:
Potentially related: #46315?
Sorry, something went wrong.
No branches or pull requests
Current definition of
tanpi
producesNaN
for large complex argument. For example,The reason is that
sinpi
andcospi
produceInf
with this argument,while
tanpi
is defined asjulia/base/special/trig.jl
Line 943 in 0163991
This
NaN
causesNaN
in some special functions. For example,See the related issue in
SpecialFunctions.jl
repo for details.Inspired by how
cotpi
is defined in mpmath:https://github.com/mpmath/mpmath/blob/5e57cb8039a3a4c9f222901a5eb2e08c53b2b2f8/mpmath/libfp.py#L153-L161
I suggest defining
tanpi
asThe text was updated successfully, but these errors were encountered: