blob: 920dfc54ac1fd0f54bf6c0fa070dfd0baf455727 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
<h4 class="subsection">Integer Type</h4> <p>Under the hood, there are two kinds of integers—small integers, called <em>fixnums</em>, and large integers, called <em>bignums</em>. </p> <p>The range of values for a fixnum depends on the machine. The minimum range is -536,870,912 to 536,870,911 (30 bits; i.e., -2**29 to 2**29 - 1) but many machines provide a wider range. </p> <p>Bignums can have arbitrary precision. Operations that overflow a fixnum will return a bignum instead. </p> <p>All numbers can be compared with <code>eql</code> or <code>=</code>; fixnums can also be compared with <code>eq</code>. To test whether an integer is a fixnum or a bignum, you can compare it to <code>most-negative-fixnum</code> and <code>most-positive-fixnum</code>, or you can use the convenience predicates <code>fixnump</code> and <code>bignump</code> on any object. </p> <p>The read syntax for integers is a sequence of (base ten) digits with an optional sign at the beginning and an optional period at the end. The printed representation produced by the Lisp interpreter never has a leading ‘<samp>+</samp>’ or a final ‘<samp>.</samp>’. </p> <div class="example"> <pre class="example">-1 ; <span class="roman">The integer -1.</span>
1 ; <span class="roman">The integer 1.</span>
1. ; <span class="roman">Also the integer 1.</span>
+1 ; <span class="roman">Also the integer 1.</span>
</pre>
</div> <p>See <a href="numbers">Numbers</a>, for more information. </p><div class="_attribution">
<p class="_attribution-p">
Copyright © 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/Integer-Type.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Integer-Type.html</a>
</p>
</div>
|