gcd

Computes the greatest common divisor of a and b by using an efficient algorithm such as Euclid's or Stein's algorithm.

  1. typeof(Unqual!(T).init % Unqual!(U).init) gcd(T a, U b)
    typeof(Unqual!(T).init % Unqual!(U).init)
    gcd
    (
    T
    U
    )
    (
    T a
    ,
    U b
    )
  2. auto gcd(T a, T b)

Parameters

a T

Integer value of any numerical type that supports the modulo operator %. If bit-shifting << and >> are also supported, Stein's algorithm will be used; otherwise, Euclid's algorithm is used as a fallback.

b U

Integer value of any equivalent numerical type.

Return Value

Type: typeof(Unqual!(T).init % Unqual!(U).init)

The greatest common divisor of the given arguments.

Meta