MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / ddAdd

Function ddAdd

src/compute-engine/numerics/special-functions.ts:2208–2213  ·  view source on GitHub ↗
(a: DD, b: DD)

Source from the content-addressed store, hash-verified

2206 const signA = n % 2 === 0 ? -1 : 1; // (−1)^{n−1}
2207 result += (signA * factorial(n - 1)) / Math.pow(z, n);
2208 result += (signA * factN) / (2 * Math.pow(z, n + 1));
2209
2210 // Bernoulli tail. The k-th factor fₖ = (2k+n−1)!/((2k)!·z^{2k+n}) is built
2211 // incrementally: f₁ = (n+1)!/(2!·z^{n+2}),
2212 // f_{k+1} = fₖ·(2k+n)(2k+n+1)/((2k+1)(2k+2)·z²).
2213 // (A previous version used n(n+1)⋯(n+2k−1)/(2k)! — a factor (n−1)! too
2214 // small; only n ≤ 2 was unaffected since 1! = 0! = 1.)
2215 let f = (factN * (n + 1)) / (2 * Math.pow(z, n + 2));
2216 let prevAbs = Infinity;

Callers 5

ddDivDFunction · 0.85
airySeriesFGFunction · 0.85
airyNegPartsFunction · 0.85
airyAiFunction · 0.85
airyBiFunction · 0.85

Calls 2

twoSumFunction · 0.85
quickTwoSumFunction · 0.85

Tested by

no test coverage detected