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

Function gamma

src/compute-engine/numerics/special-functions.ts:46–57  ·  view source on GitHub ↗
(z: number)

Source from the content-addressed store, hash-verified

44
45const GAMMA_OVERFLOW_THRESHOLD = 171.6243769563027;
46
47function gammaLanczos(z: number): number {
48 z -= 1;
49 let x = lanczos_7_c[0];
50 for (let i = 1; i < gammaG + 2; i++) x += lanczos_7_c[i] / (z + i);
51
52 const t = z + gammaG + 0.5;
53 return Math.sqrt(2 * Math.PI) * Math.pow(t, z + 0.5) * Math.exp(-t) * x;
54}
55
56function gammaBalancedProduct(start: number, count: number): number {
57 if (count <= 0) return 1;
58 if (count === 1) return start;
59
60 const leftCount = count >>> 1;

Callers 7

evaluateBinomialFunction · 0.90
arithmetic.tsFile · 0.90
incompleteGammaUpperFunction · 0.70
betaFunction · 0.70
zetaFunction · 0.70
hypergeometric2F1Function · 0.70

Calls 5

sinMethod · 0.80
gammalnFunction · 0.70
expMethod · 0.65
sqrtMethod · 0.65
powMethod · 0.65

Tested by

no test coverage detected