What is the rationale for gcd(x, y) in Fractions returning a negative
value when y is negtive?

For example gcd(3, -7) returns -1, which means that a co-prime test that
would work in many other languages 'if gcd(x, y) == 1' will fail in
Python for negative y.

And, of course, since -|x| is less than |x|, returning -|x| rather than
|x| is not returning the greatest common divisor of x and y when y is
negative.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to