ts-data-forge
    Preparing search index...
    Int32: {
        abs: (x: WithSmallInt) => IntersectBrand<Int32>;
        add: (x: WithSmallInt, y: WithSmallInt) => Int32;
        div: (x: WithSmallInt, y: ToNonZeroIntWithSmallInt<Int32>) => Int32;
        fromNumber: (x: number) => Int32;
        is: (a: number) => a is Int32;
        max: (...values: readonly WithSmallInt<Int32>[]) => Int32;
        MAX_VALUE: number;
        min: (...values: readonly WithSmallInt<Int32>[]) => Int32;
        MIN_VALUE: number;
        mul: (x: WithSmallInt, y: WithSmallInt) => Int32;
        pow: (x: WithSmallInt, y: WithSmallInt) => Int32;
        random: (min?: WithSmallInt<Int32>, max?: WithSmallInt<Int32>) => Int32;
        sub: (x: WithSmallInt, y: WithSmallInt) => Int32;
    }

    Namespace providing type-safe operations for the Int32 branded type.

    The Int32 type represents an integer in [-2^31, 2^31). Division (div) uses floor division.

    Type Declaration

    • abs: (x: WithSmallInt) => IntersectBrand<Int32>

      Returns the absolute value of an integer in [-2^31, 2^31).

      The result is non-negative and keeps the Int32 brand.

    • add: (x: WithSmallInt, y: WithSmallInt) => Int32

      Adds two integers, returning a + b as an Int32.

    • div: (x: WithSmallInt, y: ToNonZeroIntWithSmallInt<Int32>) => Int32

      Divides two integers using floor division (⌊a / b⌋): the result is a / b rounded toward negative infinity, as an Int32.

    • fromNumber: (x: number) => Int32

      Converts 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.

    • is: (a: number) => a is Int32

      Type guard that checks if a value is an integer in [-2^31, 2^31).

      isInt32 for usage examples

    • Readonlymax: (...values: readonly WithSmallInt<Int32>[]) => Int32

      Returns the largest of the given integers.

    • MAX_VALUE: number

      The largest value representable as Int32 (the upper saturation target of fromNumber).

    • Readonlymin: (...values: readonly WithSmallInt<Int32>[]) => Int32

      Returns the smallest of the given integers.

    • MIN_VALUE: number

      The smallest value representable as Int32 (the lower saturation target of fromNumber).

    • mul: (x: WithSmallInt, y: WithSmallInt) => Int32

      Multiplies two integers, returning a * b as an Int32.

    • pow: (x: WithSmallInt, y: WithSmallInt) => Int32

      Raises a to the power b, returning a ** b as an Int32 (floored to an integer).

    • random: (min?: WithSmallInt<Int32>, max?: WithSmallInt<Int32>) => Int32

      Generates a random Int32 within the given range.

      The range is inclusive on both ends.

    • sub: (x: WithSmallInt, y: WithSmallInt) => Int32

      Subtracts two integers, returning a - b as an Int32.