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

Function evaluateAbs

src/compute-engine/library/arithmetic.ts:2663–2693  ·  view source on GitHub ↗
(
  arg: Expression,
  numericApproximation?: boolean
)

Source from the content-addressed store, hash-verified

2661 if (isMatrix && elt === undefined) return undefined;
2662 if (elt === undefined) {
2663 // A scalar arm divides the point component-wise. The arm keeps the
2664 // structural view of the divisor, as the arms of a `Multiply` factor
2665 // do.
2666 results.push(
2667 quotientShapeType(
2668 point,
2669 {
2670 ...describeType(arm, den.facts.closed),
2671 structureOf: den.structureOf,
2672 },
2673 floatNumerator
2674 )
2675 );
2676 continue;
2677 }
2678 sawCollection = true;
2679 // An element type that is not known to be a number (a bare `list`)
2680 // still divides by SOME number, so it is read as `number`.
2681 let cell = quotientShapeType(
2682 point,
2683 describeType(factsOf(elt).belowNumber ? elt : 'number'),
2684 floatNumerator,
2685 true
2686 );
2687 // A cell of the divisor that can be zero gives the quotient of the point
2688 // by zero, as the scalar rule does (`pointByZeroCellType`).
2689 const zero = divisorCellZero(den, elt, inUnion);
2690 if (zero !== 'none')
2691 cell = reduceType({
2692 kind: 'union',
2693 types: [cell, pointByZeroCellType(num, point, zero)],
2694 });
2695 const r = resolveTypeAlias(arm);
2696 let dims =

Callers 1

arithmetic.tsFile · 0.85

Calls 7

isNumberFunction · 0.90
numberMethod · 0.65
absMethod · 0.65
evaluateMethod · 0.65
functionMethod · 0.65
negMethod · 0.65
isIntegerMethod · 0.45

Tested by

no test coverage detected