Binary Arithmetic

After these first two chapters, which had the purpose of a basic introduction to the fundamentals of computing, we will now see a practical application of the logical abstract reasoning and its materialization, showing how the computer does operations that are familiar to us, such as additions, subtractions, multiplications or divisions. And we will do it only through logical reasoning and through the combination of logical gates into logical circuits. During all the way, the conclusion we will take from any one of our assumptions will be one of two: either true or false, the only possibilities of an expression analyzed by a computer.
While reasoning in decimal, all this seems impossible. But when we dive into the computer world, now reasoning in binary, all deductions will refer to the duality true/false, 1 or 0, powered or unpowered. We’ll see how it’s easy to realize when reasoning this way.
We’ll have to go back to school and learn again the essence of the operations that we automated during our life, so that we can break them into every step we used to execute them and no longer perceive, thus establishing its algorithm.

Algorithm!? It seems a strange name, thus announcing something tricky, but it’s not. And it has nothing to do with mathematics although used in solving many of its problems. An algorithm is a simple decomposition of a task in its smallest components. A cooking recipe is an algorithm. The algorithms are as complex as the complexity of the task they intend to decompose. And believe, there are severely complex algorithms. But not because of the poor ones, instead because of the task that was given for them to solve.
Because the computer must always be taught starting from the most elemental simplicities, we have to take everything we want to do to the most basic essence of its composition, so that we can teach it how to do and repeat for us the things that we want it to.

With these basic principles we go into the binary arithmetic. In this chapter we examine the addition, subtraction and multiplication when performed in base 2 and with logical operators. The multiplication will be executed here while a succession of sums, just as we perform it by hand.
The division, because it can only be executed through iterations, where bit shifting, binary counting and other important circuits will be used, only will be addressed after we analyze some logical circuits. The multiplication itself is also executed by methods identical to the division ones. However, because it’s possible to execute it by a method that only uses what we have learned so far, we will approach it in that context.

The numbers we will work with can be positive and negative. How do we represent a negative number in binary? The computer must find very funny that little decoration that we put before the negative numbers, but it doesn’t have a clue  to what it is. It is extremely limited. It only knows 0 and 1. Like that, without the dash. So being, how can we tell the computer if a number is negative or positive? It is one of the issues that we will address with the required depth. Two’s complement binary numbers’s representation it’s how we will call to the representation of binary numbers that can be positive or negative, i.e. with signal.
This concept of representation of a negative number will be very important for the operation of subtraction. The subtraction of one number from another [3-2 or (+3)-(+2)] is equivalent to the sum of the symmetrical of the number we want to subtract with the first one [(+3)+(-2)]. This is the way how binary arithmetic deals with subtraction.
Another interesting topic that we will address is the Excess of an operation. What is this? In our decimal system this issue doesn’t need an approach. There is or there isn’t. It carries or it carries nothing. But in base 2 numeral system, namely in the representation of numbers in two’s complement, the question is not so simple. The sum of the highest order bit of a binary number can or can not have excess independently of its value being 0 or 1. It can be 0 and significant. It can be 1 and irrelevant. We’ll see how, because we don’t want to leave anything to chance.

See the global synopsis of this work

We introduce here the table of contents of the Paper Book to describe the themes approached in this Chapter

C3_Indice_Ing