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

Function negate

src/compute-engine/rubi/normal-form.ts:246–251  ·  view source on GitHub ↗
(ce: ComputeEngine, e: Expression)

Source from the content-addressed store, hash-verified

244}
245
246function negate(ce: ComputeEngine, e: Expression): Expression {
247 if (isNumber(e)) return e.neg().evaluate();
248 if (e.operator === 'Multiply' && e.ops && isNumber(e.ops[0]))
249 return ce._fn('Multiply', [e.ops[0].neg().evaluate(), ...e.ops.slice(1)]);
250 return ce._fn('Multiply', [ce.NegativeOne, e]);
251}

Callers 1

invertFunction · 0.70

Calls 5

isNumberFunction · 0.90
evaluateMethod · 0.65
negMethod · 0.65
_fnMethod · 0.65
sliceMethod · 0.65

Tested by

no test coverage detected