ts-fortress
    Preparing search index...

    Variable NonZeroInt16

    NonZeroInt16: {
        abs: (
            x: WithSmallInt<NonZeroInt16, 40>,
        ) => IntersectBrand<NonZeroInt16, PositiveNumber>;
        fromNumber: (x: number) => NonZeroInt16;
        is: (a: number) => a is NonZeroInt16;
        max: (...values: readonly WithSmallInt<NonZeroInt16, 40>[]) => NonZeroInt16;
        MAX_VALUE: number;
        min: (...values: readonly WithSmallInt<NonZeroInt16, 40>[]) => NonZeroInt16;
        MIN_VALUE: number;
        mul: (
            x: WithSmallInt<NonZeroInt16, 40>,
            y: WithSmallInt<NonZeroInt16, 40>,
        ) => NonZeroInt16;
        pow: (
            x: WithSmallInt<NonZeroInt16, 40>,
            y: WithSmallInt<NonZeroInt16, 40>,
        ) => NonZeroInt16;
        random: (
            min?: WithSmallInt<NonZeroInt16, 40>,
            max?: WithSmallInt<NonZeroInt16, 40>,
        ) => NonZeroInt16;
    }

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

    The NonZeroInt16 type represents a non-zero integer in [-2^15, 2^15). Division (div) uses floor division.

    Type Declaration

    • Readonlyabs: (
          x: WithSmallInt<NonZeroInt16, 40>,
      ) => IntersectBrand<NonZeroInt16, PositiveNumber>

      Returns the absolute value of a non-zero integer in [-2^15, 2^15).

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

    • ReadonlyfromNumber: (x: number) => NonZeroInt16

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

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

    • Readonlyis: (a: number) => a is NonZeroInt16

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

      isNonZeroInt16 for usage examples

    • Readonlymax: (...values: readonly WithSmallInt<NonZeroInt16, 40>[]) => NonZeroInt16

      Returns the largest of the given non-zero integers.

    • ReadonlyMAX_VALUE: number

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

    • Readonlymin: (...values: readonly WithSmallInt<NonZeroInt16, 40>[]) => NonZeroInt16

      Returns the smallest of the given non-zero integers.

    • ReadonlyMIN_VALUE: number

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

    • Readonlymul: (
          x: WithSmallInt<NonZeroInt16, 40>,
          y: WithSmallInt<NonZeroInt16, 40>,
      ) => NonZeroInt16

      Multiplies two non-zero integers, returning a * b as a NonZeroInt16.

    • Readonlypow: (
          x: WithSmallInt<NonZeroInt16, 40>,
          y: WithSmallInt<NonZeroInt16, 40>,
      ) => NonZeroInt16

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

    • Readonlyrandom: (
          min?: WithSmallInt<NonZeroInt16, 40>,
          max?: WithSmallInt<NonZeroInt16, 40>,
      ) => NonZeroInt16

      Generates a random NonZeroInt16 within the given range.

      The range is inclusive on both ends.