Adds two non-positive integers, returning a + b as a NonPositiveInt.
Converts an arbitrary number into a NonPositiveInt, rounding to the
nearest integer and saturating the result into the range [MIN_VALUE, MAX_VALUE].
Unlike asNonPositiveInt, this is total: out-of-range inputs are clamped
to the nearest representable NonPositiveInt instead of throwing.
Type guard that checks if a value is a non-positive integer.
isNonPositiveInt for usage examples
Readonlymax: (...values: readonly WithSmallInt<NonPositiveInt>[]) => NonPositiveIntReturns the largest of the given non-positive integers.
The largest value representable as NonPositiveInt (the upper saturation
target of fromNumber).
Readonlymin: (...values: readonly WithSmallInt<NonPositiveInt>[]) => NonPositiveIntReturns the smallest of the given non-positive integers.
Raises a to the power b, returning a ** b as a NonPositiveInt
(floored to an integer).
Generates a random NonPositiveInt within the given range.
The range is inclusive on both ends.
Subtracts two non-positive integers, returning a - b as a
NonPositiveInt.
Namespace providing type-safe operations for the
NonPositiveIntbranded type.The
NonPositiveInttype represents a non-positive integer. Division (div) uses floor division.Unlike
SafeInt,NonPositiveIntallows values outside the safe integer range (±2^53 − 1), so very large magnitudes may lose precision in JavaScript'snumbertype.