11 Dec
2001
11 Dec
'01
9:37 a.m.
About the GCD operator, the Haskell Report currently says: "gcd x y is the greatest integer that divides both x and y. lcm x y is the smallest positive integer that both x and y divide." Why does 'lcm' say 'positive' while 'gcd' does not? What is gcd -3 -6 Presumably 3, not -3. You could say that is obvious, since 3 > -3. So I propose to add "positive" to the gcd spec: gcd x y is the greatest POSITIVE integer that divides both x and y. I don't think that changes the specification in fact, but experience has led me to always check these things! Simon