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

Function numericValue

scripts/fungrim/numeric-check.ts:85–93  ·  view source on GitHub ↗
(x: BoxedExpression)

Source from the content-addressed store, hash-verified

83 instances: Instance[];
84 elapsedMs: number;
85};
86
87type Complex = { re: number; im: number };
88
89function numericValue(x: BoxedExpression): Complex | null {
90 const v = x.N();
91 if (!isNumber(v)) return null;
92 const re = v.re;
93 const im = v.im;
94 if (typeof re !== 'number' || typeof im !== 'number') return null;
95 if (Number.isNaN(re) || Number.isNaN(im)) return null;
96 return { re, im };

Callers 1

checkInstanceFunction · 0.70

Calls 3

isNumberFunction · 0.90
NMethod · 0.65
isNaNMethod · 0.45

Tested by

no test coverage detected