Namespace providing type-safe operations for SafeInt branded types.
SafeInt represents integers that can be exactly represented in JavaScript's
number type without precision loss. The range is [±(2^53 - 1)], which covers
approximately ±9 quadrillion.
All operations automatically clamp results to stay within the safe range,
preventing precision loss that occurs with larger integers. This makes
SafeInt ideal for:
Financial calculations requiring exact cents
Database IDs and counters
Array indices and sizes
Any integer arithmetic requiring precision guarantees
Namespace providing type-safe operations for SafeInt branded types.
SafeInt represents integers that can be exactly represented in JavaScript's number type without precision loss. The range is [±(2^53 - 1)], which covers approximately ±9 quadrillion.
All operations automatically clamp results to stay within the safe range, preventing precision loss that occurs with larger integers. This makes SafeInt ideal for: