On 2005-08-08, Bengt Richter <[EMAIL PROTECTED]> wrote: > On 7 Aug 2005 17:31:02 -0700, "Jordan Rastrick" <[EMAIL PROTECTED]> wrote: > >>Good point. I suppose I'd only ever seen it implemented with the if >>test, but you're right, the plain while loop should work fine. Silly >>me. >> >>def gcd(a,b): >> while b != 0: >> a, b = b, a%b >> return a >> >>Even nicer. >> > what is the convention for handling signed arguments? E.g.,
As far as I understand the convention is it doesn't make sense to talk about a gcd if not all numbers are positive. I would be very interested if someone knows what the gcd of 3 and -3 should/would be. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list