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

Function litVal

src/compute-engine/library/distributions.ts:50–53  ·  view source on GitHub ↗

Finite real value of a number literal, or `undefined` if not a literal.

(x: Expression)

Source from the content-addressed store, hash-verified

48function distOps(dist: Expression): ReadonlyArray<Expression> {
49 return isFunction(dist) ? dist.ops : [];
50}
51
52/** Finite real value of a number literal, or `undefined` if not a literal. */
53function litVal(x: Expression): number | undefined {
54 if (isNumber(x) && x.im === 0 && x.isFinite === true) return x.re;
55 return undefined;
56}

Callers 4

distributions.tsFile · 0.85
distributionPDFFunction · 0.85
distributionCDFFunction · 0.85
distributionQuantileFunction · 0.85

Calls 1

isNumberFunction · 0.90

Tested by

no test coverage detected