summaryrefslogtreecommitdiff
path: root/devdocs/elisp/predicates-on-numbers.html
blob: c0553cd919246282bd96102114e6419e8c556126 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 <h3 class="section">Type Predicates for Numbers</h3>  <p>The functions in this section test for numbers, or for a specific type of number. The functions <code>integerp</code> and <code>floatp</code> can take any type of Lisp object as argument (they would not be of much use otherwise), but the <code>zerop</code> predicate requires a number as its argument. See also <code>integer-or-marker-p</code> and <code>number-or-marker-p</code>, in <a href="predicates-on-markers">Predicates on Markers</a>. </p> <dl> <dt id="bignump">Function: <strong>bignump</strong> <em>object</em>
</dt> <dd><p>This predicate tests whether its argument is a large integer, and returns <code>t</code> if so, <code>nil</code> otherwise. Unlike small integers, large integers can be <code>=</code> or <code>eql</code> even if they are not <code>eq</code>. </p></dd>
</dl> <dl> <dt id="fixnump">Function: <strong>fixnump</strong> <em>object</em>
</dt> <dd><p>This predicate tests whether its argument is a small integer, and returns <code>t</code> if so, <code>nil</code> otherwise. Small integers can be compared with <code>eq</code>. </p></dd>
</dl> <dl> <dt id="floatp">Function: <strong>floatp</strong> <em>object</em>
</dt> <dd><p>This predicate tests whether its argument is floating point and returns <code>t</code> if so, <code>nil</code> otherwise. </p></dd>
</dl> <dl> <dt id="integerp">Function: <strong>integerp</strong> <em>object</em>
</dt> <dd><p>This predicate tests whether its argument is an integer, and returns <code>t</code> if so, <code>nil</code> otherwise. </p></dd>
</dl> <dl> <dt id="numberp">Function: <strong>numberp</strong> <em>object</em>
</dt> <dd><p>This predicate tests whether its argument is a number (either integer or floating point), and returns <code>t</code> if so, <code>nil</code> otherwise. </p></dd>
</dl> <dl> <dt id="natnump">Function: <strong>natnump</strong> <em>object</em>
</dt> <dd>
 <p>This predicate (whose name comes from the phrase “natural number”) tests to see whether its argument is a nonnegative integer, and returns <code>t</code> if so, <code>nil</code> otherwise. 0 is considered non-negative. </p>  <p><code>wholenump</code> is a synonym for <code>natnump</code>. </p>
</dd>
</dl> <dl> <dt id="zerop">Function: <strong>zerop</strong> <em>number</em>
</dt> <dd>
<p>This predicate tests whether its argument is zero, and returns <code>t</code> if so, <code>nil</code> otherwise. The argument must be a number. </p> <p><code>(zerop x)</code> is equivalent to <code>(= x 0)</code>. </p>
</dd>
</dl><div class="_attribution">
  <p class="_attribution-p">
    Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
    <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Predicates-on-Numbers.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Predicates-on-Numbers.html</a>
  </p>
</div>