[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Possible issue: GCD-NO-ARGUMENTS
- To: cl-cleanup@sail.stanford.edu, gls@think.com
- Subject: Possible issue: GCD-NO-ARGUMENTS
- From: Jeff Dalton <jeff%aiai.edinburgh.ac.uk@NSS.Cs.Ucl.AC.UK>
- Date: Tue, 10 Jan 89 23:37:00 GMT
- Cc: richard%aiai.edinburgh.ac.uk@NSS.Cs.Ucl.AC.UK
Richard Tobin, who shares my office, has mentioned from time to time
that both (LCM) and (GCD) are wrong in CLtL, because LCM should allow
zero arguments and GCD should not. I see there is a cleanup issue for
LCM, and, if he is right, we should also chage GCD. So I asked for a
message stating his views on GCD. Here it is:
---- Start of forwarded text ----
Date: Tue, 10 Jan 89 20:52:26 GMT
From: Richard Tobin <R.Tobin@uk.ac.ed>
To: jeff@ed.aiai
Subject: GCD in CLtL
CLtL defines (gcd) as zero, which seems bogus to me. It should be
undefined, as should (gcd 0). The reasoning goes like this:
Let f be a function that takes an arbitrary number of arguments. If
there is an "identity" i, such that (f -some-args- i) is always the
same as (f -some-args-), then the value of (f) should be the same as
(f i), if that is defined. So far, so good.
But 0 is certainly not the greatest common divisor of 0. All integers
divide 0. Furthermore, (gcd -some-args- -another-arg-) should never be
greater than (gcd -some-args-), since it adds a constraint to the set of
numbers of which we are computing the greatest. But if (gcd 0) is 0,
(gcd 4 0) (ie 4) is greater then (gcd 0).
The only reasonable value for (gcd 0) would be some representation of
infinity, but we don't have one, so it should be undefined.
-- Richard
---- End of forwarded text ----