(got: BigDecimal, wantStr: string)
| 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; |