Decimals -> Fraction strings, my solution
Dave Hansen
dhansen at cyberoptics.com
Wed May 17 11:45:22 EDT 2000
On 16 May 2000 19:04:56 -0400, =?ISO-8859-1?Q?Fran=E7ois_Pinard?=
<pinard at iro.umontreal.ca> wrote:
[...]
>
>Hi, people. I prefer the following definition for GCD:
A very nice implementation of Euclid's algorithm. I would suggest a
couple small changes to make it more robust. Shouldn't hurt the
efficiency significantly...
>
>def gcd(a, b):
a = abs(a)
b = abs(b)
if b > a:
a, b = b, a
> while a:
> a, b = b % a, a
> return b
>
>--
>François Pinard http://www.iro.umontreal.ca/~pinard
>
>
>
-=Dave
--
The opinions expressed in this post are my own and do not
represent the views of CyberOptics Corporation.
Change is inevitable. Except from a vending machine.
More information about the Python-list
mailing list