Readonlyadd: (Adds two non-negative integers, returning a + b as a NonNegativeInt16.
Readonlydiv: (Divides two non-negative integers using floor division (⌊a / b⌋): the
result is a / b rounded toward negative infinity, as a
NonNegativeInt16.
ReadonlyfromNumber: (x: number) => NonNegativeInt16Converts an arbitrary number into a NonNegativeInt16, rounding to the
nearest integer and saturating the result into the range [MIN_VALUE, MAX_VALUE].
Unlike asNonNegativeInt16, this is total: out-of-range inputs are clamped
to the nearest representable NonNegativeInt16 instead of throwing.
Readonlyis: (a: number) => a is NonNegativeInt16Type guard that checks if a value is a non-negative integer in [0, 2^15).
isNonNegativeInt16 for usage examples
Readonlymax: (...values: readonly WithSmallInt<NonNegativeInt16, 40>[]) => NonNegativeInt16Returns the largest of the given non-negative integers.
ReadonlyMAX_VALUE: numberThe largest value representable as NonNegativeInt16 (the upper saturation
target of fromNumber).
Readonlymin: (...values: readonly WithSmallInt<NonNegativeInt16, 40>[]) => NonNegativeInt16Returns the smallest of the given non-negative integers.
ReadonlyMIN_VALUE: 0The smallest value representable as NonNegativeInt16 (the lower
saturation target of fromNumber).
Readonlymul: (Multiplies two non-negative integers, returning a * b as a
NonNegativeInt16.
Readonlypow: (Raises a to the power b, returning a ** b as a NonNegativeInt16
(floored to an integer).
Readonlyrandom: (Generates a random NonNegativeInt16 within the given range.
The range is inclusive on both ends.
Readonlysub: (Subtracts two non-negative integers, returning a - b as a
NonNegativeInt16.
Namespace providing type-safe operations for the
NonNegativeInt16branded type.The
NonNegativeInt16type represents a non-negative integer in [0, 2^15). Division (div) uses floor division.