sábado, 17 de março de 2018

T116

Inglês
THE BINARY CODE by Fredric M. Menger, Emory university, Atlanta, GA., USA



What is meant when the number “five-hundred-eighty-six” is written in our so-called decimal system as 586? Using powers of 10 as the “base”, the number has been arranged below from right to left in increasing value. Thus, 586 is equivalent to (5 x 100) + (8 x 10) + (6 x 1).


Now computers do not use the decimal system with base 10 but, instead, use a “binary code” based on powers of 2 (20 to 27 being shown with the binary number 0101, equivalent to 5, below it).


As seen, numbers in binary numbers are expressed exclusively in terms of 0’s and 1’s according to which combination of powers of 2 are needed to create the number. For example, the number 5 is given above (in a so-called “4-bit code”) as 0101 because (0 x 8)+(1x4)+(0x2)+(1x1) = 4 + 1 = 5. Similarly, 9 is given by 1001 corresponding to 8 + 1 = 9. Clearly, 8 + 4 + 2 + 1 = 15 is the largest number possible with only 4 bits. Eight bits are required for a larger number like 140 which in binary code would be 10001100 representing 128 + 8 + 4 = 140. For most uses, 16 bits permit sufficiently large numbers, although 32-bit computers are common.

It is absolutely amazing that everything a computer does is provided by manipulating only 0’s and 1’s. When you type in the number 3 in a computer, the decimal number is transformed into a binary number, 0011, for further processing. Each 0 is represented by a transistor that is “off,” whereas each 1 is represented by a transistor that is “on.” Thus, four transistors (off, off, on, on) are needed to portray the number 3 in four bits (called a “byte”). Billions of transistors are found in modern computers.

In order to carry out addition in binary arithmetic, four rules must be obeyed:


An addition, shown below for 5 + 4 = 9, begins on the right and works left, following the four rules.


It is understandable that the 1 + 1 creates a 0 in the 4-column with a 1 (equivalent to a value of 8) then carried on to the adjacent 8-column. We do much the same in decimal arithmetic:

46
36
82

Thus, 6 + 6 = 12, but since we cannot place a two-digit 12 in column-1, we insert instead a 2 and then give column-10 to the left a 10 in the form of an extra 1. In transferring 1’s between columns, one must never forget their intrinsic values.

Subtraction has a different set of rules:


For example, let us carry out the subtraction of 3 from 13:


The only tricky thing is at column-2 where we are faced with subtracting a 1 from a 0. This is accomplished by borrowing the 1 from the column-4 (which is worth 4 or two 2’s), moving them to the column-2, and doing the subtraction (which is now 2 – 1 = 1). Column-4 has, in the process, become vacated. Borrowing, of course, is also needed in subtraction using the decimal system.

The subtraction of 3 from 9 in binary is left as an exercise.

Nenhum comentário:

Postar um comentário