[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SIGNUM and brain damage
- To: rwg%SPA-NIMBUS@SCRC-STONY-BROOK.ARPA
- Subject: SIGNUM and brain damage
- From: Guy.Steele@CMU-CS-A.ARPA
- Date: Mon, 22 Oct 1984 04:42:00 -0000
- Cc: common-lisp@SU-AI.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))))