From: Paul Brannan Date: 2003-02-04T07:28:53+09:00 Subject: Re: ruby-dev summary 19437-19455 On Tue, Feb 04, 2003 at 03:56:03AM +0900, Daniel Berger wrote: > Paul Brannan wrote: > > > [ruby-dev:19441] Integer#gcd > > > > > > Masaki requested a new method Integer#gcd. > > > Shugo Maeda suggested alternative name, Math.gcd(m,n). > > > > With Math#gcd know how to handle bignums and GMP integers? > > Should it be expected to? I know that the gcd method is listed as a > TODO item in Tomasz Wegrzanowski's ruby-gmp module. No, I'm just pointing out that using Math.gcd instead of Integer#gcd means that I lose the ability to easily write a function that works on both GMP integers and regular integers: # A function that returns 10 times the gcd of x and 5, for whatever # stupid reason def foo(x) case x when Integer return 10 * Math.gcd(x, 5) else return 10 * x.gcd(5) end end I would much rather write: def foo(x) return 10 * x.gcd(5) end instead of having to write a special case for Integers. Paul