GCD
Simon Peyton-Jones
simonpj@microsoft.com
Tue, 11 Dec 2001 01:37:05 -0800
About the GCD operator, the Haskell Report currently says:
"gcd x y is the greatest integer that divides both x and y.=20
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=20
that divides both x and y.=20
I don't think that changes the specification in fact, but experience
has led me to always check these things!
Simon