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

    Namespace providing type-safe operations for the NonZeroInt branded type.

    The NonZeroInt type represents a non-zero integer. Division (div) uses floor division.

    Unlike SafeInt, NonZeroInt allows values outside the safe integer range (±2^53 − 1), so very large magnitudes may lose precision in JavaScript's number type.

    Type Declaration

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

      Returns the absolute value of a non-zero integer.

      The result is non-negative and keeps the NonZeroInt brand. Note that Math.abs(Number.MIN_SAFE_INTEGER) exceeds Number.MAX_SAFE_INTEGER, so use SafeInt for guaranteed precision.

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

      Type guard that checks if a value is a non-zero integer.

      isNonZeroInt for usage examples

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

      Returns the largest of the given non-zero integers.

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

      Returns the smallest of the given non-zero integers.

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

      Multiplies two non-zero integers, returning a * b as a NonZeroInt.

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

      Raises a to the power b, returning a ** b as a NonZeroInt (floored to an integer).

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

      Generates a random NonZeroInt within the given range.

      The range is inclusive on both ends.