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

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

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

    Type Declaration

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

      Adds two SafeUint values.

    • clamp: (x: number) => SafeUint

      Clamps a number to the safe unsigned integer range.

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

      Divides one SafeUint by another using floor division.

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

      Type guard to check if a value is a SafeUint.

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

      Returns the larger of two SafeUint values.

    • ReadonlyMAX_VALUE: SafeUint

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

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

      Returns the smaller of two SafeUint values.

    • ReadonlyMIN_VALUE: 0

      The minimum value for a safe unsigned integer.

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

      Multiplies two SafeUint values.

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

      Raises a SafeUint to the power of another SafeUint.

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

      Generates a random SafeUint value within the valid range.

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

      Subtracts one SafeUint from another.