UNPKG

exactnumber

Version:

Arbitrary-precision decimals. Enables making math calculations with rational numbers, without precision loss.

16 lines (11 loc) 317 B
import { FixedNumber } from '../../FixedNumber'; export class ConstantCache { private fn: (digits: number) => string; constructor(fn: (digits: number) => string) { this.fn = fn; } get(digits: number): FixedNumber { const calculated = new FixedNumber(this.fn(digits)); return calculated; } }