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

Function bigRelErr

test/compute-engine/distributions.test.ts:192–201  ·  view source on GitHub ↗
(got: BigDecimal, wantStr: string)

Source from the content-addressed store, hash-verified

190 // itself lose the digits we are trying to measure.
191 function bigRelErr(got: BigDecimal, wantStr: string): number {
192 const saved = BigDecimal.precision;
193 BigDecimal.precision = saved + 30;
194 try {
195 const want = B(wantStr);
196 return got.sub(want).abs().div(want.abs()).toNumber();
197 } finally {
198 BigDecimal.precision = saved;
199 }
200 }
201
202 describe('50-digit precision', () => {
203 beforeEach(() => {
204 BigDecimal.precision = 50;

Callers 1

Calls 5

BFunction · 0.85
toNumberMethod · 0.80
divMethod · 0.65
absMethod · 0.65
subMethod · 0.65

Tested by

no test coverage detected