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

Function refRounded

test/big-decimal/exp-reduction.test.ts:46–54  ·  view source on GitHub ↗

* Return the reference rounded to `p` significant digits, as a decimal string * comparable to BigDecimal.toString() (drop trailing zeros of the reference by * relying on the same significand rounding BigDecimal uses).

(arg: string, p: number)

Source from the content-addressed store, hash-verified

44 * relying on the same significand rounding BigDecimal uses).
45 */
46function refRounded(arg: string, p: number): BigDecimal {
47 const saved = BigDecimal.precision;
48 BigDecimal.precision = p;
49 try {
50 return new BigDecimal(REFS[arg]).toPrecision(p);
51 } finally {
52 BigDecimal.precision = saved;
53 }
54}
55
56const PRECISIONS = [15, 21, 50, 100, 200, 500];
57

Callers 1

Calls 1

toPrecisionMethod · 0.80

Tested by

no test coverage detected