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

    Namespace providing type-safe arithmetic operations for 32-bit non-zero signed integers.

    All operations automatically clamp results to the valid NonZeroInt32 range [-2147483648, 2147483647] excluding 0. This ensures that all arithmetic maintains the 32-bit non-zero signed integer constraint, preventing zero results and overflow.

    Type Declaration

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

      Returns the absolute value of a 32-bit non-zero signed integer.

    • clamp: (x: number) => NonZeroInt32

      Clamps a number to the NonZeroInt32 range (avoiding zero).

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

      Type guard to check if a value is a NonZeroInt32.

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

      Returns the larger of two NonZeroInt32 values.

    • ReadonlyMAX_VALUE: number

      The maximum value for a 32-bit non-zero signed integer.

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

      Returns the smaller of two NonZeroInt32 values.

    • ReadonlyMIN_VALUE: number

      The minimum value for a 32-bit non-zero signed integer.

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

      Multiplies two NonZeroInt32 values.

      The product of two non-zero integers is always non-zero, so this stays closed; for the non-closed operations (add/sub/div, whose result may be 0) use Num.add/Num.sub/Num.divInt.

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

      Raises a NonZeroInt32 to the power of another NonZeroInt32.

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

      Generates a random NonZeroInt32 value within the valid range.