3 ms·
A positive integer has an infinite number of leading zeroes, and a negative integer in two's complement has an infinite number of leading ones. On the machine
by rep_lodsb 4y ago
A positive integer has an infinite number of leading zeroes, and a negative integer in two's complement has an infinite number of leading ones.
On the machine level, you have registers of limited width, and there are usually instructions that sign-extend a shorter integer by setting all the high bits to '1' if it is negative.
By convention, the highest bit indicates the sign, but mathematically it's "arithmetic modulo 2^n", and any value can be interpreted as both positive and negative. For example, a 4 bit register containing '0111' would normally be interpreted as decimal 7, but could also represent -9.
Lisp - like many other interpreted languages - uses arbitrary precision integers, so while not infinite they can be very large.
- _19qg 4y ago> Lisp - like many other interpreted languages and the best thing: Lisp isn't an interpreted language and never was.