The greatest common divisor (gcd) of two integers is the same as the gcd of their absolute values. Therefore, the function can just replace negative integers by their negatives, which are positive.
Can you have a gcd of 0?
The above definition cannot be used for defining gcd(0, 0), since 0 × n = 0, and zero thus has no greatest divisor. However, zero is its own greatest divisor if greatest is understood in the context of the divisibility relation, so gcd(0, 0) is commonly defined as 0.
Can common factors be negative?
Technically, in the world of mathematics - the answer to this question is yes. There are negative factors and multiples of numbers. For example, -4 and -3 are factors of 12, -24 is a multiple of 3, and the factors of 4 would be -4, -2, -1, 1, 2, 4. ... This also applies for multiples.