Here is an example of erroneous output when nu isa Int but correct output when nu isa Float64 of the same value:
julia> besselj_deriv_zero(37, 1)
0.0
julia> besselj_deriv_zero(37.0, 1)
39.71488992674072
The problem can be traced to integer overflow when computing the numerator of variable t4 in function bessel_deriv_zero_asymptotic. A similar problem with overflow occurs when computing the numerator of variable t4 in function bessel_zero_asymptotic, though it doesn't manifest until larger values of nu are used:
julia> FunctionZeros.besselj_zero_asymptotic(87, 1)
103.5246288334123
julia> FunctionZeros.besselj_zero_asymptotic(87.0, 1)
100.99682928339313
This error doesn't propagate out of besselj_zero because the erroneous asymptotic value is still close enough to the true zero for the latter to be found by the rootfinder.
I think that the solution is to promote nu to float(abs(nu_in)) whenever nu_in is an Integer. I'll work on a PR that implements this.
Here is an example of erroneous output when
nu isa Intbut correct output whennu isa Float64of the same value:The problem can be traced to integer overflow when computing the numerator of variable
t4in functionbessel_deriv_zero_asymptotic. A similar problem with overflow occurs when computing the numerator of variable t4 in functionbessel_zero_asymptotic, though it doesn't manifest until larger values ofnuare used:This error doesn't propagate out of
besselj_zerobecause the erroneous asymptotic value is still close enough to the true zero for the latter to be found by the rootfinder.I think that the solution is to promote
nutofloat(abs(nu_in))whenevernu_inis anInteger. I'll work on a PR that implements this.