
8 Jul
2009
8 Jul
'09
9:57 a.m.
Henning Thielemann antwortete roconnor@theorem.ca:
As much as I'd love gcd 0 0 to be 0, the major problem is that this change would contradict the Haskell 98 report.
There was a long thread about this issue some years ago that came to the conclusion that the current behaviour of gcd is algebraically most sound.
Huh? Algebraically, gcd is the binary greatest-lower-bound operation in the divisibility ordering of the naturals, or in the divisibility preordering on the integers. In both, 0 is the unique top element (everything divides zero). Therefore, ``gcd 0 0 = 0'' is even ``more algebraically justified'' than ``gcd (-2) (-6) = 2'', which is what both hugs and ghc produce. Wolfram