polynomial.js
function(a, b) {

    // gcd = a * s  +  b * t

    var s = 0, t = 1, u = 1, v = 0;
    while (a !== 0) {

      var q = b / a | 0, r = b % a;
      var m = s - u * q, n = t - v * q;

      b = a;
      a = r;
      s = u;
      t = v;
      u = m;
      v = n;
    }
    return [b /* gcd*/, s, t];
  }
function(a, b) {

    // gcd = a * s  +  b * t

    var s = 0, t = 1, u = 1, v = 0;
    while (a !== 0) {

      var q = b / a | 0, r = b % a;
      var m = s - u * q, n = t - v * q;

      b = a;
      a = r;
      s = u;
      t = v;
      u = m;
      v = n;
    }
    return [b /* gcd*/, s, t];
  }
function ( a , b ) { // gcd = a * s  +  b * t var s = 0 , t = 1 , u = 1 , v = 0 ; while ( a !== 0 ) { var q = b / a | 0 , r = b % a ; var m = s - u * q , n = t - v * q ; b = a ; a = r ; s = u ; t = v ; u = m ; v = n ; } return [ b /* gcd*/ , s , t ] ; }
Calculates the extended gcd

@param {number} a
@param {number} b
@returns {Array}
Calculates the extended gcd