(lispref.info)Predicates on Numbers


Next: Comparison of Numbers Prev: Float Basics Up: Numbers

Type Predicates for Numbers
===========================

   The functions in this section test whether the argument is a number
or whether it is a certain sort of number.  The functions `integerp'
and `floatp' can take any type of Lisp object as argument (the
predicates would not be of much use otherwise); but the `zerop'
predicate requires a number as its argument.  See also
`integer-or-marker-p' and `number-or-marker-p', in Note: Predicates on
Markers.

 - Function: floatp OBJECT
     This predicate tests whether its argument is a floating point
     number and returns `t' if so, `nil' otherwise.

     `floatp' does not exist in Emacs versions 18 and earlier.

 - Function: integerp OBJECT
     This predicate tests whether its argument is an integer, and
     returns `t' if so, `nil' otherwise.

 - Function: numberp OBJECT
     This predicate tests whether its argument is a number (either
     integer or floating point), and returns `t' if so, `nil' otherwise.

 - Function: natnump OBJECT
     The `natnump' predicate (whose name comes from the phrase
     "natural-number-p") tests to see whether its argument is a
     nonnegative integer, and returns `t' if so, `nil' otherwise.  0 is
     considered non-negative.

     Markers are not converted to integers, hence `natnump' of a marker
     is always `nil'.

     People have pointed out that this function is misnamed, because
     the term "natural number" is usually understood as excluding zero.
     We are open to suggestions for a better name to use in a future
     version.

 - Function: zerop NUMBER
     This predicate tests whether its argument is zero, and returns `t'
     if so, `nil' otherwise.  The argument must be a number.

     These two forms are equivalent: `(zerop x) == (= x 0)'.


automatically generated by info2www