Returns the absolute value of a negative integer.
The result is non-negative and keeps the NegativeInt brand. Note that
Math.abs(Number.MIN_SAFE_INTEGER) exceeds Number.MAX_SAFE_INTEGER, so
use SafeInt for guaranteed precision.
Adds two negative integers, returning a + b as a NegativeInt.
Converts an arbitrary number into a NegativeInt, rounding to the
nearest integer and saturating the result into the range [MIN_VALUE, MAX_VALUE].
Unlike asNegativeInt, this is total: out-of-range inputs are clamped to
the nearest representable NegativeInt instead of throwing.
Type guard that checks if a value is a negative integer.
isNegativeInt for usage examples
Readonlymax: (...values: readonly WithSmallInt<NegativeInt>[]) => NegativeIntReturns the largest of the given negative integers.
The largest value representable as NegativeInt (the upper saturation
target of fromNumber).
Readonlymin: (...values: readonly WithSmallInt<NegativeInt>[]) => NegativeIntReturns the smallest of the given negative integers.
Raises a to the power b, returning a ** b as a NegativeInt (floored
to an integer).
Generates a random NegativeInt within the given range.
The range is inclusive on both ends.
Subtracts two negative integers, returning a - b as a NegativeInt.
Namespace providing type-safe operations for the
NegativeIntbranded type.The
NegativeInttype represents a negative integer. Division (div) uses floor division.Unlike
SafeInt,NegativeIntallows values outside the safe integer range (±2^53 − 1), so very large magnitudes may lose precision in JavaScript'snumbertype.