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

Function atPrecision

test/big-decimal/ln-agm.test.ts:16–24  ·  view source on GitHub ↗
(p: number, fn: () => T)

Source from the content-addressed store, hash-verified

14});
15
16function atPrecision<T>(p: number, fn: () => T): T {
17 const saved = BigDecimal.precision;
18 BigDecimal.precision = p;
19 try {
20 return fn();
21 } finally {
22 BigDecimal.precision = saved;
23 }
24}
25
26function firstDigits(x: BigDecimal, n: number): string {
27 return x.toPrecision(n).toString();

Callers 1

ln-agm.test.tsFile · 0.70

Calls 1

fnFunction · 0.85

Tested by

no test coverage detected