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

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

    All operations automatically clamp results to the non-zero safe integer range, excluding zero. This ensures that all arithmetic maintains both the non-zero constraint and IEEE 754 precision guarantees, preventing precision loss while ensuring results are never zero.

    Type Declaration

    • abs: (x: WithSmallInt) => ToNonNegative<NonZeroSafeInt>

      Returns the absolute value of a non-zero safe integer.

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

      Adds two NonZeroSafeInt values.

    • clamp: (x: number) => NonZeroSafeInt

      Clamps a number to the non-zero safe integer range.

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

      Divides one NonZeroSafeInt by another using floor division.

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

      Type guard to check if a value is a NonZeroSafeInt.

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

      Returns the larger of two NonZeroSafeInt values.

    • ReadonlyMAX_VALUE: SafeUint

      The maximum safe integer value (2^53 - 1).

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

      Returns the smaller of two NonZeroSafeInt values.

    • ReadonlyMIN_VALUE: SafeInt

      The minimum safe integer value (-(2^53 - 1)).

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

      Multiplies two NonZeroSafeInt values.

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

      Raises a NonZeroSafeInt to the power of another NonZeroSafeInt.

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

      Generates a random NonZeroSafeInt value within the valid range.

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

      Subtracts one NonZeroSafeInt from another.