JuliaMath / JuliaMath/SpecialFunctions.jl
besselk with a BigFloat argument fails
- Dominant language
- Julia
- Stars
- 381
- Forks
- 113
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 1
Description
I'm trying to update some code that currently uses my own implementation of the inverse Laplace transform to use [InverseLaplace.jl](https://github.com/jlapeyre/InverseLaplace.jl) instead. My code makes a call like `SpecialFunctions.besselk(0, x)`. My implementation of the inverse Laplace transform results in `x` having type `Float64`, but InverseLaplace.jl wants `x` to be a `BigFloat`. This creates a problem
```
julia> SpecialFunctions.besselk(0, 1.0)
0.42102443824070834
julia> SpecialFunctions.besselk(0, BigFloat(1.0))
ERROR: MethodError: no method matching besselk(::BigFloat, ::Complex{BigFloat})
Closest candidates are:
besselk(::T<:AbstractFloat, ::Complex{T<:AbstractFloat}) where T<:AbstractFloat at /homedir/.julia/v0.6/SpecialFunctions/src/bessel.jl:502
besselk(::Real, ::Complex) at /homedir/.julia/v0.6/SpecialFunctions/src/bessel.jl:499
besselk(::Any...; kwargs...) at deprecated.jl:1303
...
Stacktrace:
[1] besselk(::Float64, ::Complex{BigFloat}) at /homedir/.julia/v0.6/SpecialFunctions/src/bessel.jl:500
[2] besselk(::Int64, ::BigFloat) at /homedir/.julia/v0.6/SpecialFunctions/src/bessel.jl:450
```
It seems like that first candidate fits the bill, but julia disagrees.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the besselk methods and stack-trace location in src/bessel.jl, then reproduce the reported calls with Float64 and BigFloat arguments. Check the existing tests for besselk behavior and consider the issue addressed when the BigFloat call no longer raises the shown MethodError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100