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