Skip to content

bigIntPow10

bigIntPow10(exp): bigint

Defined in: packages/core/src/big-int/pow10.ts:28

10^exp as a bigint for non-negative integer exp.

Strategy:

  • exp ∈ [0, 18]: constant lookup in _bigPowersOf10 (O(1))
  • exp ∈ [19, 255]: lazy-expanded mutable table, populated on first access by multiplying the last entry by 10n; expansion is idempotent (no locking needed in a single-threaded JS runtime)
  • exp > 255: falls back to 10n ** BigInt(exp) — no table entry

number

bigint

bigIntPow10(0); // → 1n
bigIntPow10(18); // → 1000000000000000000n
bigIntPow10(100); // → 10n**100n
```;