Next: , Up: Programming Types

2.3.1 Integer Type

The range of values for integers in Emacs Lisp is −536870912 to 536870911 (30 bits; i.e., -2**29 to 2**29 − 1) on typical 32-bit machines. (Some machines provide a wider range.) Emacs Lisp arithmetic functions do not check for overflow. Thus (1+ 536870911) is −536870912 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.