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

Function printAccuracyTable

test/big-decimal/comprehensive-benchmark.ts:127–145  ·  view source on GitHub ↗
(results: AccuracyResult[])

Source from the content-addressed store, hash-verified

125}
126
127function printAccuracyTable(results: AccuracyResult[]) {
128 console.log(
129 ` ${'Operation'.padEnd(25)} ${'Prec'.padStart(5)} ${'BD digits'.padStart(10)} ${'DJ digits'.padStart(10)} ${'BD rel err'.padStart(12)} ${'DJ rel err'.padStart(12)}`
130 );
131 console.log(
132 ` ${'─'.repeat(25)} ${'─'.repeat(5)} ${'─'.repeat(10)} ${'─'.repeat(10)} ${'─'.repeat(12)} ${'─'.repeat(12)}`
133 );
134 for (const r of results) {
135 const bdDig = r.bdDigits === Infinity ? '∞ (exact)' :
136 r.bdDigits >= r.precision ? `${r.bdDigits} ✓` : `${r.bdDigits}`;
137 const djDig = r.djDigits === Infinity ? '∞ (exact)' :
138 r.djDigits >= r.precision ? `${r.djDigits} ✓` : `${r.djDigits}`;
139 const bdErr = r.bdRelErr === 0 ? '0' : r.bdRelErr.toExponential(2);
140 const djErr = r.djRelErr === 0 ? '0' : r.djRelErr.toExponential(2);
141 console.log(
142 ` ${r.name.padEnd(25)} ${String(r.precision).padStart(5)} ${bdDig.padStart(10)} ${djDig.padStart(10)} ${bdErr.padStart(12)} ${djErr.padStart(12)}`
143 );
144 }
145}
146
147// ================================================================
148// PART 1: Performance Benchmarks

Callers 1

Calls 1

logMethod · 0.65

Tested by

no test coverage detected