(bits: number)
| 642 | let _fppiCache: { bits: number; value: bigint } | null = null; |
| 643 | |
| 644 | function fppi(bits: number): bigint { |
| 645 | if (_fppiCache !== null) { |
| 646 | if (_fppiCache.bits === bits) return _fppiCache.value; |
| 647 | if (_fppiCache.bits > bits) |
| 648 | return _fppiCache.value >> BigInt(_fppiCache.bits - bits); |
| 649 | } |
| 650 | const value = computeFppi(bits); |
| 651 | _fppiCache = { bits, value }; |
| 652 | return value; |
| 653 | } |
| 654 | |
| 655 | function computeFppi(bits: number): bigint { |
| 656 | // We need ~bits·log10(2) decimal digits of PI, plus guard digits. |
no test coverage detected