Thanks for all the replies, it looks like there is a lot of support for
having gcd 0 0 = 0.
I've since discovered that there was a similar discussion in 2001, where
the majority supported gcd 0 0 = 0, but the suggested change was never
implemented.
On 2 May 2009, at 04:05, Steve wrote:
Why is gcd 0 0 undefined?
In math, one may define gcd(x, y) as a generator of the ideal
generated by x and y in the ring of integers Z. The gcd(x, y) then
always exists as the ring Z is a PID (principal ideal domain), i.e.,
all ideals can be
Hi Steve,
Steve wrote:
Why is gcd 0 0 undefined?
That's a good question. Can you submit an official proposal?
http://www.haskell.org/haskellwiki/Library_submissions
Thanks,
Martijn.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
[Question moved over from Haskell-Beginners]
I had a look at the gcd definition in GHC 6.10.1
ghc-6.10.1/libraries/base/GHC/Real.lhs
-- | @'gcd' x y@ is the greatest (positive) integer that divides both
@x@
-- and @y@; for example @'gcd' (-3) 6@ = @3@, @'gcd' (-3) (-6)@ = @3@,
-- @'gcd' 0 4@ =