Home > PHP > Function > GMP > gmp_gcdext()

gmp_gcdext()

gmp_gcdext - Calculate GCD and multipliers

Syntax

array gmp_gcdext (resource $a, resource $b)

Arguments

  • a - It can be either a GMP number resource, or a numeric string given that it is possible to convert the latter to a number.
  • b - It can be either a GMP number resource, or a numeric string given that it is possible to convert the latter to a number.

Description

Calculates g, s, and t, such that a*s + b*t = g = gcd(a,b), where gcd is the greatest common divisor. Returns an array with respective elements g, s and t.

Version

PHP 4.0.4, 5

Return value

An array of GMP numbers.