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

Function erfInvApprox

src/compute-engine/numerics/special-functions.ts:313–318  ·  view source on GitHub ↗

* Winitzki's approximation for the inverse error function, accurate to * ~2e-3 relative over (-1, 1). Used as the Newton seed for `erfInv()` and * `bigErfInv()`.

(x: number)

Source from the content-addressed store, hash-verified

311 * for real a > 0, b > 0 and 0 ≤ x ≤ 1. Returns NaN outside that domain, and
312 * the exact endpoints 0 (x=0) and 1 (x=1).
313 */
314export function betaRegularized(x: number, a: number, b: number): number {
315 if (Number.isNaN(x) || Number.isNaN(a) || Number.isNaN(b)) return NaN;
316 if (a <= 0 || b <= 0 || x < 0 || x > 1) return NaN;
317 if (x === 0) return 0;
318 if (x === 1) return 1;
319 const bt = Math.exp(
320 gammaln(a + b) -
321 gammaln(a) -

Callers 2

erfInvFunction · 0.85
bigErfInvFunction · 0.85

Calls 3

signMethod · 0.80
logMethod · 0.65
sqrtMethod · 0.65

Tested by

no test coverage detected