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

Function sampleResult

benchmarks/audit/audit.ts:53–62  ·  view source on GitHub ↗
(boxed: any, c: any)

Source from the content-addressed store, hash-verified

51const casePoints = (c: any): number[][] =>
52 (c.verify.points || []).map((p: any) => (Array.isArray(p) ? p.map(parseFloat) : [parseFloat(p)]));
53const sampleResult = (boxed: any, c: any) => {
54 const vars: string[] = c.verify.vars ?? ['x'];
55 return casePoints(c).map((tuple) => {
56 try {
57 const subs: Record<string, any> = {};
58 vars.forEach((v, i) => (subs[v] = ce.number(tuple[i])));
59 return num(boxed.subs(subs));
60 } catch { return null; }
61 });
62};
63
64// [mant, exp] with v = mant·10^exp, |mant| ∈ [1, 10) — from a decimal string
65// (possibly in scientific notation), for exact constants whose magnitude

Callers 1

runCEFunction · 0.85

Calls 5

casePointsFunction · 0.85
numFunction · 0.70
mapMethod · 0.65
numberMethod · 0.65
subsMethod · 0.65

Tested by

no test coverage detected