Readonlyabs: (x: WithSmallInt<NonZeroInt, 40>) => IntersectBrand<NonZeroInt, PositiveNumber>Returns the absolute value of a non-zero integer.
The result is non-negative and keeps the NonZeroInt brand. Note that
Math.abs(Number.MIN_SAFE_INTEGER) exceeds Number.MAX_SAFE_INTEGER, so
use SafeInt for guaranteed precision.
Readonlyis: (a: number) => a is NonZeroIntType guard that checks if a value is a non-zero integer.
isNonZeroInt for usage examples
Readonlymax: (...values: readonly WithSmallInt<NonZeroInt, 40>[]) => NonZeroIntReturns the largest of the given non-zero integers.
Readonlymin: (...values: readonly WithSmallInt<NonZeroInt, 40>[]) => NonZeroIntReturns the smallest of the given non-zero integers.
Readonlymul: (x: WithSmallInt<NonZeroInt, 40>, y: WithSmallInt<NonZeroInt, 40>) => NonZeroIntMultiplies two non-zero integers, returning a * b as a NonZeroInt.
Readonlypow: (x: WithSmallInt<NonZeroInt, 40>, y: WithSmallInt<NonZeroInt, 40>) => NonZeroIntRaises a to the power b, returning a ** b as a NonZeroInt (floored
to an integer).
Readonlyrandom: (Generates a random NonZeroInt within the given range.
The range is inclusive on both ends.
Namespace providing type-safe operations for the
NonZeroIntbranded type.The
NonZeroInttype represents a non-zero integer. Division (div) uses floor division.Unlike
SafeInt,NonZeroIntallows values outside the safe integer range (±2^53 − 1), so very large magnitudes may lose precision in JavaScript'snumbertype.