The runtime implementation uses the recurrence relations `J(n-1, x) = (2.0 / x) * n * J(n, x) - J(n+1, x)` `Y(n+1, x) = (2.0 / x) * n * Y(n, x) - Y(n-1, x)` (see https://dlmf.nist.gov/10.74.iv and https://dlmf.nist.gov/10.6.E1). Although the standard requires that `N1` and `N2` in `BESSEL_JN(N1, N2, x)` and `BESSEL_YN(N1, N2, x)` be non-negative, this is not checked in the runtime functions. This is in keeping with some other compilers which also return some results when `N1` and/or `N2` are negative. The special case for `x == 0` is handled in different runtime functions for each of `BESSEL_JN` and `BESSEL_YN`. The lowering code checks for this case and inserts the checks and the appropriate runtime calls in FIR. The existing tests for the two intrinsics was modified to keep the style consistent with the additional lowering tests that were added.
32 KiB
32 KiB