Readonlyabs: (x: WithSmallInt<Int16, 40>) => IntersectBrand<Int16, NonNegativeNumber>Returns the absolute value of an integer in [-2^15, 2^15).
The result is non-negative and keeps the Int16 brand.
Readonlyadd: (x: WithSmallInt<Int16, 40>, y: WithSmallInt<Int16, 40>) => Int16Adds two integers, returning a + b as an Int16.
Readonlydiv: (Divides two integers using floor division (⌊a / b⌋): the result is a / b rounded toward negative infinity, as an Int16.
ReadonlyfromNumber: (x: number) => Int16Converts an arbitrary number into an Int16, rounding to the nearest
integer and saturating the result into the range [MIN_VALUE, MAX_VALUE].
Unlike asInt16, this is total: out-of-range inputs are clamped to the
nearest representable Int16 instead of throwing.
Readonlyis: (a: number) => a is Int16Type guard that checks if a value is an integer in [-2^15, 2^15).
isInt16 for usage examples
Readonlymax: (...values: readonly WithSmallInt<Int16, 40>[]) => Int16Returns the largest of the given integers.
ReadonlyMAX_VALUE: numberThe largest value representable as Int16 (the upper saturation target of
fromNumber).
Readonlymin: (...values: readonly WithSmallInt<Int16, 40>[]) => Int16Returns the smallest of the given integers.
ReadonlyMIN_VALUE: numberThe smallest value representable as Int16 (the lower saturation target of
fromNumber).
Readonlymul: (x: WithSmallInt<Int16, 40>, y: WithSmallInt<Int16, 40>) => Int16Multiplies two integers, returning a * b as an Int16.
Readonlypow: (x: WithSmallInt<Int16, 40>, y: WithSmallInt<Int16, 40>) => Int16Raises a to the power b, returning a ** b as an Int16 (floored to
an integer).
Readonlyrandom: (min?: WithSmallInt<Int16, 40>, max?: WithSmallInt<Int16, 40>) => Int16Generates a random Int16 within the given range.
The range is inclusive on both ends.
Readonlysub: (x: WithSmallInt<Int16, 40>, y: WithSmallInt<Int16, 40>) => Int16Subtracts two integers, returning a - b as an Int16.
Namespace providing type-safe operations for the
Int16branded type.The
Int16type represents an integer in [-2^15, 2^15). Division (div) uses floor division.