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

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

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

    Type Declaration

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

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

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

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

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

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

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

    • fromNumber: (x: number) => Int16

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

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

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

      isInt16 for usage examples

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

      Returns the largest of the given integers.

    • MAX_VALUE: number

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

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

      Returns the smallest of the given integers.

    • MIN_VALUE: number

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

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

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

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

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

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

      Generates a random Int16 within the given range.

      The range is inclusive on both ends.

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

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