Exact: a + b = s + e, assuming |a| ≥ |b| (fast two-sum)
(a: number, b: number)
| 2189 | |
| 2190 | /** Power series (DLMF 10.25.2): I_n(x) = (x/2)^n Σ (x²/4)^k / (k!(n+k)!). |
| 2191 | * All terms are positive — no cancellation at any x. Kahan-compensated: |
| 2192 | * near x = 30 the ~60 accumulations otherwise cost ~5 ulp. */ |
| 2193 | function besselISeries(n: number, x: number): number { |
| 2194 | const halfX = x / 2; |
| 2195 | const quarter = (x * x) / 4; |
| 2196 | let term = 1; |
| 2197 | for (let i = 1; i <= n; i++) term /= i; |