ts-data-forge
    Preparing search index...

    Function div

    • Performs type-safe exact division with a compile-time zero-check.

      The divisor must be typed as NonZeroNumber or a non-zero numeric literal. The result sign follows the quotient rule; because exact division can be fractional, the level is finite (or number).

      Type Parameters

      • A extends number
      • B extends
            | 1
            | 2
            | NonZeroNumber
            | 3
            | 4
            | 5
            | 6
            | 7
            | 8
            | 9
            | 11
            | 10
            | 20
            | 30
            | 12
            | 13
            | 14
            | 15
            | 16
            | 17
            | 18
            | 19
            | 21
            | 22
            | 23
            | 24
            | 25
            | 26
            | 27
            | 28
            | 29
            | 31
            | 32
            | 33
            | 34
            | 35
            | 36
            | 37
            | 38
            | 39
            | -1
            | -2
            | -40
            | -3
            | -4
            | -5
            | -6
            | -7
            | -8
            | -9
            | -11
            | -10
            | -20
            | -30
            | -12
            | -13
            | -14
            | -15
            | -16
            | -17
            | -18
            | -19
            | -21
            | -22
            | -23
            | -24
            | -25
            | -26
            | -27
            | -28
            | -29
            | -31
            | -32
            | -33
            | -34
            | -35
            | -36
            | -37
            | -38
            | -39

      Parameters

      • a: A

        The dividend.

      • b: B

        The divisor (must be non-zero, enforced by types).

      Returns DivResult<A, B>

      a / b, typed as the tightest branded type guaranteed to contain it.