Closed
Description
e.g. besselj(n, 0.1)
should underflow to zero for n > 110
(as checked via WolframAlpha), but our implementation underflows for n > 100
.
Worse, for sufficiently large orders it "un-underflows". For example, besselj(2.0^70, 0.1)
gives 2.1386280643e-314
instead of 0.0.
Worse, the behavior for large orders is not pure: it depends upon previous function calls! Consider the following two examples (both after restarting Julia):
julia> besselj(2.0^70, 0.1)
2.1386280643e-314
julia> besselj(2^70, 0.1)
0.9975015620660401
(where 2^70
gives 0
, so the the latter is the correct result for besselj(0, 0.1)
), but:
julia> besselj(2^70, 0.1)
0.9975015620660401
julia> besselj(2.0^70, 0.1)
0.9975015620660401
where somehow the earlier result for 2^70
has "corrupted" the later result for 2.0^70
!!!