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

Function finalize

benchmarks/audit/wester.ts:406–408  ·  view source on GitHub ↗
(v: any, res: any, against: any[])

Source from the content-addressed store, hash-verified

404 : res.values.every((v: any) => v != null && Math.abs(v) < 1e-6) ? { v: 'solved' } : { v: 'wrong' };
405const covers = (a: number[], b: number[]) => b.every((br) => a.some((ar) => Math.abs(ar - br) <= 1e-6 * (1 + Math.abs(br))));
406// GCD is defined up to a constant, so two gcds agree iff one is a scalar multiple
407// of the other (constant ratio across sample points).
408const gcdSolved = (res: any) => res && res.status === 'ok' && res.values && res.values.length >= 2 && res.values.every((v: any) => v != null && isFinite(v));
409const scalarMultiple = (a: number[], b: number[]) => {
410 const ratios: number[] = [];
411 for (let i = 0; i < a.length; i++) if (a[i] != null && b[i] != null && b[i] !== 0) ratios.push(a[i] / b[i]);

Callers 1

wester.tsFile · 0.85

Calls 1

coversFunction · 0.70

Tested by

no test coverage detected