xen-dev-utils
    Preparing search index...

    Function gcd

    • Greatest common divisor of two integers.

      Zero is treated as the identity element: gcd(0, x) = gcd(x, 0) = x

      The sign of the result is essentially random for negative inputs.

      Parameters

      • a: number

        The first integer.

      • b: number

        The second integer.

      Returns number

      The largest integer that divides a and b.

    • Greatest common divisor of two integers.

      Zero is treated as the identity element: gcd(0, x) = gcd(x, 0) = x

      The sign of the result is essentially random for negative inputs.

      Parameters

      • a: bigint

        The first integer.

      • b: bigint

        The second integer.

      Returns bigint

      The largest integer that divides a and b.