gcd 0 0 = 0

Ch. A. Herrmann herrmann@infosun.fmi.uni-passau.de
Mon, 17 Dec 2001 18:31:17 +0100

>>>>> "George" == George Russell <ger@tzi.de> writes:

    George> I've reconsidered my earlier position and think now that the
    George> Prelude is wrong to make gcd 0 0 an error, and should return
    George> 0.  It probably doesn't make much difference to anyone, but
    George> it's like 1 not being a prime; it may be slightly harder to
    George> explain, but it makes the maths come out nicer and is in the
    George> end a simplification.

I'm strongly against making 1 a prime number.

In contrast, 0*x=0, thus 0 "divides" 0 (somehow).
But I have problems with "gcd being the greatest positive integer ..."

- 0 is not positive, it is non-negative or natural
- 2 also divides 0 and 2 is a "greater integer" than 0
  (0 is the top element of the lattice formed by the division relation
   but that is not clear by the expression "greatest")

Anyway, gcd 0 0 = error  would be the simplest way to avoid confusion
and catch accidental programming errors; e.g., using the gcd to divide
something else.