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

    Namespace providing type-safe arithmetic operations for negative safe integers.

    NegativeSafeInt represents safe integers that are strictly less than zero ([Number.MIN_SAFE_INTEGER, -1]). Operations that stay within the negative safe integers clamp their results to the valid range, while operations whose result leaves the set (mul, div, abs) are typed to reflect the actual sign of the result.

    Type Declaration

    • abs: (x: WithSmallInt<NegativeSafeInt>) => PositiveSafeInt

      Returns the absolute value of a negative safe integer.

      The negative safe integer.

      The absolute value as a PositiveSafeInt.

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

      Adds two negative safe integers.

    • clamp: (x: number) => NegativeSafeInt

      Clamps a number to the NegativeSafeInt range.

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

      Type guard to check if a value is a NegativeSafeInt.

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

      Returns the larger of two negative safe integers.

    • ReadonlyMAX_VALUE: -1

      The maximum value for a negative safe integer.

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

      Returns the smaller of two negative safe integers.

    • ReadonlyMIN_VALUE: number

      The minimum value for a negative safe integer.

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

      Raises a negative safe integer to the power of another negative safe integer.

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

      Generates a random NegativeSafeInt value within the valid range.

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

      Subtracts one negative safe integer from another.

      The mathematical result can be positive, so it is clamped to the NegativeSafeInt range (maximum -1).