Adds two non-positive integers.
The result is clamped to the non-positive integer range. If the sum is positive, it is clamped to 0.
Clamps a number to the non-positive integer range.
Any positive value is clamped to 0 (the maximum non-positive integer). Negative values are preserved as long as they are valid integers.
Type guard that checks if a value is a non-positive integer.
Readonlymax: (...values: readonly WithSmallInt<NonPositiveInt>[]) => NonPositiveIntReturns the larger of two non-positive integers.
Since non-positive integers range from negative infinity to 0, the larger value is the one closer to zero (less negative).
ReadonlyMAX_VALUE: 0The maximum value for a non-positive integer.
Readonlymin: (...values: readonly WithSmallInt<NonPositiveInt>[]) => NonPositiveIntReturns the smaller of two non-positive integers.
Since non-positive integers range from negative infinity to 0, the smaller value is the one further from zero (more negative).
Raises a non-positive integer to the power of another non-positive integer.
The result is clamped to the non-positive integer range.
Generates a random non-positive integer value.
Subtracts one non-positive integer from another.
The result is clamped to the non-positive integer range. If the result is positive, it is clamped to 0.
Namespace providing type-safe operations for NonPositiveInt branded types.
NonPositiveInt represents integers that are less than or equal to zero (<= 0). All operations automatically clamp results to maintain the non-positive constraint, ensuring that arithmetic operations never produce positive values.
This type is essential for: