SIGNUM and brain damage

• To: Guy.Steele@CMU-CS-A.ARPA
• Subject: SIGNUM and brain damage
• From: Bill Gosper <rwg%SPA-NIMBUS@SCRC-STONY-BROOK.ARPA>
• Date: Sat, 3 Nov 84 07:44 PST
• Cc: common-lisp@SU-AI.ARPA, mlb%SPA-NIMBUS@SCRC-STONY-BROOK.ARPA
• In-reply-to: The message of 21 Oct 84 21:42-PDT from Guy.Steele at CMU-CS-A

Date: 22 Oct 84 0042 EDT (Monday)
From: Guy.Steele@CMU-CS-A.ARPA
In-Reply-To: "rwg%SPA-NIMBUS@SCRC-STONY-BROOK.ARPA's message of 18 Oct 84 00:49-EST"

I'm probably guilty here, if guilt there be.  Floating-point contagion
may have been the disease, but remember also that Common Lisp adopted
the APL extension to SIGNUM, namely that SIGNUM of a complex number
returns that point on the unit circle on the ray from the origin to
the argument (or zero if the argument is zero).  That lent more impetus
to following the usual contagion rules (both floating and complex).
It also allows the following fairly elegant definition:
(defun signum (x) (if (zerop x) x (/ x (abs x))))
--Guy

Well, I hardly think invoking divide is elegant, and the complex numbers are
broken without complex infinity, which is phaseless, and must therefore
constitute a fourth value of signum, but that's another story.

A much cruftier corollary of floating contagion shows up in min and max.
It is a contradiction to say "max returns the argument that is greatest ..."
and then in the next sentence say "the implementation is free to produce
... [some rational's] floating point approximation".  Such an approximation
is generally not any of the arguments, or worse, it may even by = to an argument
that was not the largest!