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

Function round

src/compute-engine/interval/elementary.ts:489–494  ·  view source on GitHub ↗
(x: Interval | IntervalResult)

Source from the content-addressed store, hash-verified

487 if (m !== 0) vs = scalePow2(v, -n * m);
488 }
489
490 const guess = Math.pow(vs, 1 / n);
491 let lo = guess;
492 let move = 1;
493 for (let attempt = 0; powChainUp(lo, n) > vs; attempt++) {
494 // Giving up is sound, not merely conservative: 0 is below every root of a
495 // positive number, and `Infinity` is above every root.
496 if (attempt >= MAX_ROOT_SEARCH_ATTEMPTS) {
497 lo = 0;

Callers 5

remainderFunction · 0.85
timeitFunction · 0.85
timeitFunction · 0.85
ops-bench.pyFile · 0.85

Calls 2

unwrapOrPropagateFunction · 0.90
roundStepFunction · 0.85

Tested by

no test coverage detected