* Number of decimal digits in |significand|, computed once and cached on this * immutable value. `toPrecision`, `cmp`, `div`, `pow`, `ln` etc. all re-derive * the order of magnitude from the (unchanging) significand; caching turns the * O(log n) bigint `bigintDigits` count into an O(1) reus
()
| 169 | * @internal |
| 170 | */ |
| 171 | _digitCount(): number { |
| 172 | // The frozen static constants pre-seed `_digits` (see their definitions), so |
| 173 | // the cache-write below is only ever reached on non-frozen, mutable |
| 174 | // instances — no `Object.isFrozen` guard needed on this hot miss path. |
| 175 | return this._digits ?? (this._digits = bigintDigits(this.significand)); |
| 176 | } |
| 177 | |
| 178 | constructor(value: string | number | bigint | BigDecimal) { |
| 179 | if (value instanceof BigDecimal) { |
no test coverage detected