Next:

Integer Basics ============== The range of values for an integer depends on the machine. The range is -8388608 to 8388607 (24 bits; i.e., -2**23 to 2**23 - 1 ) on most machines, but on others it is -16777216 to 16777215 (25 bits), or -33554432 to 33554431 (26 bits). All of the examples shown below assume an integer has 24 bits. The Lisp reader reads numbers as a sequence of digits with an optional sign. 1 ; The integer 1. +1 ; Also the integer 1. -1 ; The integer -1. 16777217 ; Also the integer 1, due to overflow. 0 ; The number 0. -0 ; The number 0. 1. ; The integer 1. To understand how various functions work on integers, especially the bitwise operators (Note:Bitwise Operations.), it is often helpful to view the numbers in their binary form. In 24 bit binary, the decimal integer 5 looks like this: 0000 0000 0000 0000 0000 0101 (We have inserted spaces between groups of 4 bits, and two spaces between groups of 8 bits, to make the binary integer easier to read.) The integer -1 looks like this: 1111 1111 1111 1111 1111 1111 -1 is represented as 24 ones. (This is called "two's complement" notation.) The negative integer, -5, is creating by subtracting 4 from -1. In binary, the decimal integer 4 is 100. Consequently, -5 looks like this: 1111 1111 1111 1111 1111 1011 In this implementation, the largest 24 bit binary integer is the decimal integer 8,388,607. In binary, this number looks like this: 0111 1111 1111 1111 1111 1111 Since the arithmetic functions do not check whether integers go outside their range, when you add 1 to 8,388,607, the value is negative integer -8,388,608: (+ 1 8388607) => -8388608 => 1000 0000 0000 0000 0000 0000 Many of the following functions accept markers for arguments as well as integers. (Note:Markers.) More precisely, the actual parameters to such functions may be either integers or markers, which is why we often give these parameters the name INT-OR-MARKER. When the actual parameter is a marker, the position value of the marker is used and the buffer of the marker is ignored.

automatically generated byinfo2www