| |
||
| |
Created it, 06/09/09
Update it, 06/09/20
N° Visitors
In this new lesson, we will consider two methods to represent the numbers and we will approach the operations which are attached to it.
Each one of these methods calls upon a numbering system from which the base is different.
The most spread, that you know well, is that which uses base 10. The other, employed in the digital circuits, is at base 2.
We will not take again all the concepts of arithmetic learned at the school but we will especially seek to re-examine certain points. The latter will be useful for you for a better comprehension of the arithmetic employee in the circuits the electronic ones.
1. - THE DECIMAL NOTATION
The numbers, whatever the numbering system used, represent signals of which we can draw from information if we know the codes which govern them.
The first of these codes consists in adopting graphics to represent different
quantities.
Graphics which spread for us, are those which were transmitted to us by the Arabs and who constitute the Arab numerals.
The second code relates to weighting related to each one of these figures.
Indeed, these graphics, aligned after from/to each other, will be affected of a weight according to their row (the weakest weight being affected with the row on the right).
This weight, or value, granted to the row is variable according to the base of the system used for numeration.
The third code determines this base of numeration.
In this case, it is about the system at base 10.
Graphics used are as follows :
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
They constitute the continuation of the Arab numerals from zero to nine (10 symbols for base 10).
By using these strict rules and using these symbols, we can represent all the integers or fractional.
Figure 1 illustrates, using the quoted rules, the representation of the number 2048 (two thousand forty eights) bases 10 of them. It is about an integer.
It is necessary to make the distinction between figure and a number. A figure is a graphics, the number represents a report/ratio or a quantity (compared to a reference) and makes up of one or more figures.
A number is known as entirety when it represents a full report (when this report/ratio forms a whole). Example: 74, 127, 1230, 2048 are integers.
A number is known as fractional when, by opposition, it does not represent a whole report/ratio and that it is the expression of a fraction.
A decimal number is the result of a fraction whose denominator is a power of 10.
Example : 12,7 ; 576,048
The decimal part is separated from the whole part by a comma (the Anglo-Saxons replace the comma by a point).
In figure 1, the units are represented by 100.
By convention, 100 = 1 and generally, b0 = 1 (b being the base of the numbering system).
Figure 2 illustrates the procedure of representation of a decimal fractional number.
This way of allotting a weight growing according to the row occupied by the figure inside the number is called in general term, a numeration of position.
In the number, the figure which occupies the highest weight is named : the most significant digit or in summary C.L.P.S.
On the other hand, that which occupies the weakest row is named : the least significant digit or C.L.M.S.
The decimal point is placed between the positive powers and the negative powers of the base.
This limit separates the whole part of the fractional part.
The displacement of this comma of a row towards the positive powers of the base, corresponds to a division of the number by the base.
On the other hand, the displacement of the comma of a row towards the negative powers, corresponds to a multiplication of the number by the base.
This numeration of position which distributes a weight to each row takes also the qualifier of balanced (of Latin “laid” which means weight).
The numbering system at base 10 is a case among good of others, because we can use other bases provided that that which one chooses is an integer at least equal to 2.
Consequently, to know in which base the number is represented, it will be necessary to make it follow of an index specifying this base.
Examples :
102410 represents the number thousand twenty four bases 10 of them.
10002 represents the number one, zero, zero, zero bases 2 of them (this number corresponds to 8 bases 10 of them).
In the human relations, we use practically only numbers in decimal notation and, so the index specifying the base disappears.
It should be also noted that a number represented in another system (other that base 10), should not be pronounced same manner, but while enumerating, from the strongest weight towards the weakest weight, each figure or graphics constituting this number.
2. - THE BINARY
NOTATION
This system takes again the same rules as the decimal notation.
As its name indicates it, it is founded on two values represented by following graphics: {0, 1}.
Numeration at base 2 uses, for the representation of the numbers, the position occupied by the figure in the number and grants to this position a weight defined beforehand.
We find the three principal points used also into decimal, i.e. :
graphics
weighting
the base of numeration.
Numeration at base 2 is, in this kind of representation of the numbers, the simplest system, therefore that which the machine will be able to interpret best because it comprises only two symbols.
On the other hand, it does not have a great advantage with regard to the contraction in the figuration of the numbers.
Example : 19 into decimal are written into binary (i.e. bases 2 of them) : 10011.
This same quantity is represented by two graphics bases 10 of them whereas one needs 5 of them bases 2 of them.
Figure 3 illustrates the representation of the numbers in balanced numeration at base 2.
To find the equivalent decimal of the number binary 101101 of the example of figure 3, one takes, for each 1 binary, the decimal value of the weight occupied by the row of each one of these figures. One adds then each partial result. This sum corresponds to the decimal number are equivalent.
In this case, 25 + 23 + 22 + 20 is 32 + 8 + 4 + 1 = 45. The decimal number 45 is the equivalent of the binary number 101101.
The base constitutes to some extent a container. To measure a given quantity, plus the container is large, plus the entering number of containers, or containing, this quantity will be weak.
Thus, if only four different rows or weights are used :
in base 2, one will be able to count from 0 to 1510 (from 0 to 11112) whereas bases 10 of them, one will be able to count from 0 to 999910.
In the numerical systems, one is brought to transform the binary one into decimal or opposite.
For this opposite operation, one can also use the table of figure 3.
That is to say to transpose number 27 in its binary equivalent.
One breaks up this number into the sum of the binary weights (noted into decimal) contents in this number. One transposes each one of these weights into binary (using the table, figure 3) and one carries out the sum (figure 4).
27 = 16 + 8 + 2 + 1
Another method consists in dividing successively by 2, the decimal number. The remainder of each division, as well as the last quotient, constitute the binary equivalent. This last quotient corresponds to the figure of the highest row of the binary number thus obtained.
That is to say to transpose 2910 into binary. Figure 5 clarifies this other method.
As in the decimal system, the fractional numbers must be represented. The whole part is separated from the fractional part by a comma (the Anglo-Saxons use a point).
The weight of the rows is represented by the affected number corresponding to the base of numeration, while exposing, of the chronological order of the row preceded by the negative sign.
The negative exhibitors correspond to fractions, from where the name of fractional numbers.
Examples :
Figure 6 represents the procedure of writing of a fractional number into binary.
The binary numbers are, for us, difficult to handle and complicated to read. When a dialog must be established between the technician and the machine, one has recourse to the coding of the binary data. For example, code BCD (Binary Coded Decimal), makes it possible to read or transpose more easily information.
This code calls only upon the binary numbers 0000 to 1001 (0 to 910).
Each group of four bits (bit = binary digit = binary digit) represents on the basis of the line its decimal equivalent and the affected weight with its row.
The weakest weight is always located on the right.
Example: 9910 is written into normal binary 01100011.
In BCD, it becomes :
99 into decimal is written in BCD
: 1001 1001.
In short, it is the decimal system of representation but one replaces the decimal digits by their binary equivalents.
3. - NOTATIONS HEXADECIMAL AND OCTAL
In certain machines, when it is necessary to introduce data, one uses another base of numeration. It is about hexadecimal (16 base).
Figure 7 gives equivalence for the first 32 numbers between the decimal one, the binary one, the hexadecimal one and the octal one.
Into hexadecimal, graphics used are 16. It is :
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}
This notation simplifies the representation of the numbers.
The errors, during the transposition of information of the technician (hexadecimal) to the machine (into binary), are considerably reduced.
This requires, inside the machine, a translation system of hexadecimal into binary (and conversely), because if the digital circuits can interpret several languages, they “think” into binary.
Example: number 25510 is written into hexadecimal : FF (whereas he is written into binary : 11111111).
One thus avoids the writing of a great number of graphics, removing by there the errors of carelessness.
Continuously in this way, it is enough that the interpreter is capable to include/understand a language close to the spoken language and the dialog with the machine is simplified considerably. It is the orientation which has been given for a few years already for the computers and the languages known as : “advanced”.
Numeration at base 8 is also used in numerical electronics, one indicates it under the term : Octal.
Graphics which this numeration uses are as follows:
{0, 1, 2, 3, 4, 5, 6, 7}
The representation of the numbers in this numeration is carried out same manner as for those described previously; it uses the numeration of position.
We will be delayed a little on these codes and will take an example.
That is to say to transpose the decimal number 99 into binary, octal then hexadecimal.
To transform a decimal number into normal binary, it is necessary to break up this number into powers of 2.
We defer on the figure 8 which gathers the powers of 2, from 0 to 20.
We will seek which is the greatest power of 2 included/understood entirely and once in the decimal number.
27 = 128 is not contained in 99.
26 = 64 is contained in 99.
But 64 does not correspond entirely to 99, there is a remainder : 99 - 64 = 35.
We continue to seek the power of 2 contents in 35 :
25 = 32 is contained in 35.
We seek the remainder and continue the process until the null remainder.
35 - 32 = 3
21 = 2 is contained in 3.
Remain : 3 - 2 = 1
20 = 1 is contained in 1.
Remain: 1 - 1 = 0. We obtain as follows :
99 = 26 + 25 + 21 + 20
The power of 2 indicates the row to us corresponding to the binary weight contained entirely and once in the decimal number considered. This is why we will place one 1 (binary) at the place of the row indicated while exposing (see figure 3). It is what is carried out figure 9.
We have just transposed a decimal number in its binary equivalent.
To pass from decimal to octal, it is a simple means which consists in passing by the binary one.
The binary, equivalent number of the decimal number, that one wishes to transform, is divided by sections of three digits while starting with the line. Each group of three digits represents a new number. Each one of these numbers is transposed in as many figures into octal, the whole of these figures constituting the octal number are equivalent.
The fact of adding two zeros at the head binary number does not change anything with the number.
Why divide the binary number into sections of three digits ?
Because base 8 corresponds to a whole power of 2 (thus of base 2), indeed, 8 = 23. In base 8, graphics or figures which one can allot to the rows go from 0 to 7. To obtain these figures into binary, it is necessary to have three rows:
It appears clearly that three rows, or consecutive weights to represent the seven figures of which is made up the octal system, are necessary and sufficient.
To transform a decimal number into a hexadecimal number, one uses the same method which consists in passing by the binary one. The hexadecimal one is also a whole power of the system at base 2. But since graphics are 16, one will cut out the binary number by sections of 4 digits which one will transpose in hexadecimal figures in order to obtain the hexadecimal number.
Any numbering system whose base corresponds to a whole power of 2, will be able to use the same procedure. For example, for a system at base 32 (that is to say 25), one divides the binary number into sections of 5 digits. one obtains :
Let us gather our results : 9910 Ž 11000112 Ž 1438 Ž 6316 Ž 3332
In this example, the hexadecimal number does not comprise a letter. We saw on figure 7 that this system beyond 9 comprised the letters :
A, B, C, D, E, F
These letters are essential because there are no figures envisaged in this case. One could invent some very well, any drawing would make the deal, but, in digital electronics (instructions of the microprocessors), they are employed officially. Moreover, it would be necessary to give them a pronunciation.
Now let us see an example using these letters. That is to say to transpose 23410 in its equivalent 16 base some (hexadecimal). Figure 10 first of all gives the course of operation for the passage into binary.
Let us divide the binary number obtained into sections of four digits.
Number 23410 has as an equivalent the hexadecimal number : EA.
Number 25510 has as an equivalent the hexadecimal number : FF.
This way of representing a number with letters can appear surprising, but if you carry out automatisms with microprocessors, you will have to enter the instructions into hexadecimal and this notation will appear natural to you then.
This way of dividing the binary number into sections of n figures to obtain the equivalent in another base, power whole of 2, is not applicable for base 10, or decimal (10 is not a whole power of 2).
To represent the ten figures of this base, one needs, despite everything, four rows of binary weights. Those, consequently, are badly exploited since they allow the representation of the sixteen symbols.
The decimal symbols, from 0 to 9, use the bit configurations from 0000 to 1001.
| Following
page |
![]()