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

Function negate

src/compute-engine/interval/arithmetic.ts:51–56  ·  view source on GitHub ↗
(x: Interval | IntervalResult)

Source from the content-addressed store, hash-verified

49 * -[a, b] = [-b, -a]
50 */
51export function negate(x: Interval | IntervalResult): IntervalResult {
52 const unwrapped = unwrapOrPropagate(x);
53 if (!Array.isArray(unwrapped)) return unwrapped;
54 const [xVal] = unwrapped;
55 return ok({ lo: -xVal.hi, hi: -xVal.lo });
56}
57
58/**
59 * Internal multiplication helper that returns plain Interval.

Callers 1

Calls 2

unwrapOrPropagateFunction · 0.90
okFunction · 0.90

Tested by

no test coverage detected