ConstAdds two PositiveSafeInt values.
Clamps a number to the positive safe integer range.
Divides one PositiveSafeInt by another using floor division.
Type guard to check if a value is a PositiveSafeInt.
assert.ok(isPositiveSafeInt(1));
assert.ok(isPositiveSafeInt(Number.MAX_SAFE_INTEGER));
assert.notOk(isPositiveSafeInt(0));
assert.ok(PositiveSafeInt.is(42));
isPositiveSafeInt for usage examples
Readonlymax: (...values: readonly WithSmallInt<PositiveSafeInt, 40>[]) => PositiveSafeIntReturns the larger of two PositiveSafeInt values.
ReadonlyMAX_VALUE: SafeUintThe maximum safe integer value (2^53 - 1).
Readonlymin: (...values: readonly WithSmallInt<PositiveSafeInt, 40>[]) => PositiveSafeIntReturns the smaller of two PositiveSafeInt values.
ReadonlyMIN_VALUE: 1The minimum value for a positive safe integer.
Multiplies two PositiveSafeInt values.
Raises a PositiveSafeInt to the power of another PositiveSafeInt.
Generates a random PositiveSafeInt value within the valid range.
Subtracts one PositiveSafeInt from another.
Namespace providing type-safe arithmetic operations for positive safe integers.
All operations automatically clamp results to the positive safe integer range [1, MAX_SAFE_INTEGER]. This ensures that all arithmetic maintains both the positive constraint and IEEE 754 precision guarantees, preventing precision loss and ensuring results are always positive.