Skip to content

incorrect bessel functions of large order #4366

Closed
@stevengj

Description

@stevengj

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!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions