Qu

gcd

Builtin index · Core maths

result = gcd(a, b)

Input: a, b · Output: result

What it is

Greatest common divisor of two integers (always non-negative; gcd(0, 0) is 0). Each argument is an integer number or a Vec of integers; two equal-length Vecs work elementwise, and a number pairs with every element of a Vec.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = gcd(a, b)
a number or VecEach argument is an integer number or a Vec of integers.
b —not documented yet
2^53 —where f64 stops holding every integer
Returns a number, or a Vec if either argument is one. Errors: a non-integer, a magnitude above 2^53 (where f64 stops holding every integer), mismatched Vec lengths.

Examples

No documentation example calls this form yet. The Core maths chapter is where one belongs.