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

Function enumerateInteger2

src/compute-engine/interval/elementary.ts:911–931  ·  view source on GitHub ↗

* Tight enclosure of an integer-valued binary function over the integer grid * spanned by two intervals, by enumerating every grid point. Returns `null` * when the grid is too large to enumerate (caller supplies a conservative * fallback). Corner sampling is unsound here: these functions are not

(
  a: Interval,
  b: Interval,
  f: (x: number, y: number) => number
)

Source from the content-addressed store, hash-verified

909 }
910
911 if (xVal.lo > 0) {
912 return ok({ lo: Math.log2(xVal.lo), hi: Math.log2(xVal.hi) });
913 }
914
915 return {
916 kind: 'partial',
917 value: { lo: -Infinity, hi: Math.log2(xVal.hi) },
918 domainClipped: 'lo',
919 };
920}
921
922/**
923 * Absolute value of an interval.
924 */
925function absRaw(x: Interval | IntervalResult): IntervalResult {
926 const unwrapped = unwrapOrPropagate(x);
927 if (!Array.isArray(unwrapped)) return unwrapped;
928 const [xVal] = unwrapped;
929 if (isNaNInterval(xVal)) return ok(NAN_INTERVAL);
930 if (xVal.lo >= 0) {
931 return ok(xVal);
932 }
933 if (xVal.hi <= 0) {
934 return ok({ lo: -xVal.hi, hi: -xVal.lo });

Callers 3

binomialFunction · 0.85
gcdFunction · 0.85
lcmFunction · 0.85

Calls 4

okFunction · 0.90
integerPointsFunction · 0.85
fFunction · 0.50
isFiniteMethod · 0.45

Tested by

no test coverage detected