ErgoEmacsEmacsLispBlogEmacsLispBuy Tutorial
Web Hosting by 1&1

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 most machines. (Some machines may provide a wider range.) It is important to note that the Emacs Lisp arithmetic functions do not check for overflow. Thus (1+ 536870911) is −536870912 on most machines.

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.
     1073741825       ; Also the integer 1 on a 30-bit implementation.

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, on most machines 536870912 is read as the floating-point number 536870912.0.

See Numbers, for more information.

blog comments powered by Disqus