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

Function exactMode

src/compute-engine/library/statistics.ts:790–805  ·  view source on GitHub ↗
(ce: ComputeEngine, vals: Expression[])

Source from the content-addressed store, hash-verified

788 // mean, the mean of its first and last elements: it is not walked.
789 const m = rangeClosedFormOfOperand(
790 ops,
791 expression,
792 numericApproximation,
793 (x) => rangeMeanClosedForm(engine, x, numericApproximation)
794 );
795 if (m !== undefined) return m;
796 // ONE walk of the data decides all three verdicts — an absent datum
797 // or empty input (`NaN`), a provably non-numeric datum (an error), or
798 // symbolic data (stay inert rather than fold a valueless symbol to
799 // `NaN`) — and feeds both paths below. See `collectData`.
800 const xs = collectData(engine, 'Mean', ops);
801 if (xs === null) return undefined;
802 if (!Array.isArray(xs)) return xs;
803 // Complex data: the arithmetic mean is linear over the complex
804 // numbers, so no convention has to be chosen and the answer is the
805 // complex mean — `Mean([1, 1+2i])` is `1 + i`. The boxed accumulation
806 // serves both paths: it is exact on exact data, and `.N()`
807 // numericizes what it returns.
808 //

Callers 1

statistics.tsFile · 0.85

Calls 5

sortExactFunction · 0.85
toStringMethod · 0.65
getMethod · 0.65
setMethod · 0.65
valuesMethod · 0.65

Tested by

no test coverage detected