function _gcd(a, b) {
  if (!isInteger(a) || !isInteger(b)) {
    throw new Error('Parameters in function gcd must be integer numbers');
  } // https://en.wikipedia.org/wiki/Euclidean_algorithm


  var r;

  while (b !== 0) {
    r = a % b;
    a = b;
    b = r;
  }

  return a < 0 ? -a : a;
}
Calculate gcd for numbers
@param {number} a
@param {number} b
@returns {number} Returns the greatest common denominator of a and b
@private