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

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

    All operations automatically clamp results to the valid NonPositiveSafeInt range [Number.MIN_SAFE_INTEGER, 0]. This ensures that all arithmetic maintains the non-positive safe integer constraint, with positive results clamped to 0 and underflow results clamped to MIN_VALUE.

    Type Declaration

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

      Adds two NonPositiveSafeInt values.

    • clamp: (x: number) => NonPositiveSafeInt

      Clamps a number to the NonPositiveSafeInt range.

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

      Type guard to check if a value is a NonPositiveSafeInt.

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

      Returns the larger of two NonPositiveSafeInt values.

    • ReadonlyMAX_VALUE: 0

      The maximum value for a non-positive safe integer.

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

      Returns the smaller of two NonPositiveSafeInt values.

    • ReadonlyMIN_VALUE: number

      The minimum value for a non-positive safe integer.

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

      Raises a NonPositiveSafeInt to the power of another NonPositiveSafeInt.

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

      Generates a random NonPositiveSafeInt value within the valid range.

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

      Subtracts one NonPositiveSafeInt from another.