ts-data-forge
    Preparing search index...

    Variable Int8

    Int8: {
        abs: <N extends Int8>(x: N) => AbsoluteValue<N>;
        add: (x: Int8, y: Int8) => Int8;
        div: (x: Int8, y: StrictExclude<Int8, 0>) => Int8;
        fromNumber: (a: number) => Int8;
        is: (x: number) => x is Int8;
        max: (...values: readonly Int8[]) => Int8;
        MAX_VALUE: 127;
        min: (...values: readonly Int8[]) => Int8;
        MIN_VALUE: -128;
        mul: (x: Int8, y: Int8) => Int8;
        pow: (x: Int8, y: Int8) => Int8;
        random: (min: Int8, max: Int8) => Int8;
        sub: (x: Int8, y: Int8) => Int8;
    }

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

    The Int8 type represents an integer in [-128, 127]. Division (div) uses floor division.

    Type Declaration

    • abs: <N extends Int8>(x: N) => AbsoluteValue<N>

      Returns the absolute value of an integer in [-128, 127].

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

    • add: (x: Int8, y: Int8) => Int8

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

    • div: (x: Int8, y: StrictExclude<Int8, 0>) => Int8

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

    • fromNumber: (a: number) => Int8

      Converts an arbitrary number into an Int8, rounding to the nearest integer and saturating the result into the range [MIN_VALUE, MAX_VALUE].

      Unlike asInt8, this is total: out-of-range inputs are clamped to the nearest representable Int8 instead of throwing.

    • is: (x: number) => x is Int8

      Type guard that checks if a value is an integer in [-128, 127].

      isInt8 for usage examples

    • Readonlymax: (...values: readonly Int8[]) => Int8

      Returns the largest of the given integers.

    • MAX_VALUE: 127

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

    • Readonlymin: (...values: readonly Int8[]) => Int8

      Returns the smallest of the given integers.

    • MIN_VALUE: -128

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

    • mul: (x: Int8, y: Int8) => Int8

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

    • pow: (x: Int8, y: Int8) => Int8

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

    • random: (min: Int8, max: Int8) => Int8

      Generates a random Int8 within the given range.

      The range is inclusive on both ends.

    • sub: (x: Int8, y: Int8) => Int8

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