Next: Floating-Point Type, Up: Programming Types [Contents][Index]
The range of values for an integer 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.
Emacs Lisp arithmetic functions do not check for integer overflow. Thus
(1+ 536870911)
is -536,870,912 if Emacs integers are 30 bits.
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 ‘+’ or a final ‘.’.
-1 ; The integer -1. 1 ; The integer 1. 1. ; Also the integer 1. +1 ; Also the integer 1.
As a special exception, if a sequence of digits specifies an integer
too large or too small to be a valid integer object, the Lisp reader
reads it as a floating-point number (see Floating-Point Type).
For instance, if Emacs integers are 30 bits, 536870912
is read
as the floating-point number 536870912.0
.
See Numbers, for more information.