As you know, computers internally work only with ones and zeros, and everything is represented in some way using these “bits.” Using M bits you can encode 2M different values. Let’s say you’re interested in encoding the signed integers …, -1, 0, 1, 2, …. To make things simple, let’s use a fixed number of …
Tag Archives: Integers
Infinite integers
Lately we’ve discussed how integers work in computers when their size is limited to a fixed number of bits. What if there is no such limitation and we can use as many bits as we want? As computers get more and more powerful we’d like to derive this case by looking at what happens when …
Why We Use Two’s Complement
Previously we discussed the mathematical foundations of computer integers and found that, as far as arithmetic is concerned, we can choose to use any range of N = 2m numbers, and the arithmetic operations that have to be implemented in hardware are not affected. Why is it then that in most programming languages we are …
Mathematics of computer integers
Integers have typically a fixed size in computers, for example 32 or 64 bits. Since there are no such limits on the size of integers in mathematics, the question arises: how do computer integers work, with respect to mathematical theory?