Signum
Indicator for positive, negative, or zero
(Signum x) is 0 if x is 0, -1 if x is
negative, and is 1 otherwise.
The guard for signum requires its argument to be rational
(real, in ACL2(r)) number.
Signum is a Common Lisp function. See any Common Lisp documentation
for more information.
From ``Common Lisp the Language'' page 206, we see a definition of
signum in terms of abs. As explained elsewhere (see abs),
the guard for abs requires its argument to be a rational (real, in ACL2(r)) number; hence, we make the same restriction for
signum.
Function: signum
(defun signum (x)
(declare (xargs :guard (real/rationalp x)))
(if (zerop x) 0 (if (minusp x) -1 1)))