Updated the, 02/01/2020
Visiteurs
N°
Home |
Summaries |
Microcomputers |
Physical |
Technologies |
Mathematical Forms |
Access to all our Products |
Overview of all our Products |
Our Lessons in PDF Formats |
Data Processing |
Forums |
Miscellaneous and others |
Binary number | Hexadecimal and Octal numbers | Footer |
Decimal Numeration - Binary - Hexadecimal - Octal :
In this new lesson, we will consider two methods to represent numbers and discuss related operations.
Each of these methods uses a numbering system whose base is different.
The most common, which you know well, is the one that uses the base 10. The other one, used in the digital circuits, is based on 2.
We will not go back to all the notions of arithmetic learned at school, but we will focus on revising certain points. These will be useful for a better understanding of the arithmetic used in electronic circuits.
1. - DECIMAL NUMERATION
Numbers, regardless of the numbering system used, represent signals from which we can derive information if we know the code or codes that govern them.
The first of these codes is to adopt graphics to represent different quantities.
The graphics that have become widespread for us are those that were transmitted to us by the Arabs and which constitute the Arabic numerals.
The second code relates to the weighting related to each of these figures.
Indeed, these graphics, aligned after each other, will be weighted according to their rank (the lowest weight is assigned to the rightmost rank).
This weight, or value, given to rank is variable according to the basis of the system used for the count.
The third code determines this number base.
In this case, it is the 10-based system.
The graphics used are :
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
They are the sequence of Arabic numerals from zero to nine (10 symbols for base 10).
Using these strict rules and using these symbols, we can represent all integers or fractional numbers.
Figure 1 illustrates, using the rules cited, the representation of the number 2048 (two thousand and forty eight) in base 10. This is an integer.
We must distinguish between number and number. A number is a graphic, the number represents a ratio or quantity (relative to a reference) and consists of one or more digits.
A number is called integer when it represents a complete report (when this report forms a whole). Example: 74, 127, 1230, 2048 are integers.
A number is said to be fractional when, by contrast, it does not represent a whole relationship and 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 10^{0}.
By convention, 10^{0} = 1 and in general, b^{0} = 1 (b being the basis of the numbering system).
Figure 2 illustrates the procedure for representing a fractional fractional number.
This way of assigning increasing weight according to the rank occupied by the number within the number is called in general terms, a position number.
In the number, the figure which occupies the highest weight is called : the most significant or abbreviated number C.L.P.S.
On the other hand, the one with the lowest rank is called 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 integer part from the fractional part.
The displacement of this comma of a rank towards the positive powers of the base, corresponds to a division of the number by the base.
On the other hand, moving the decimal point from one rank to the negative powers corresponds to a multiplication of the number by the base.
This position number which distributes a weight to each rank also takes the qualifier of weighted (from the Latin "Pondus" which means weight).
The 10-based numbering system is one of many, because we can use other bases provided that the one we choose is an integer at least equal to 2.
Therefore, to know in what basis the number is represented, it will be necessary to follow it with an index specifying this basis.
Examples :
1024_{10} represents the number one thousand and twenty four in base 10.
1000_{2} represents the number one, zero, zero, zero in base 2 (this number corresponds to 8 in base 10).
In human relations, we practically only use numbers in decimal numbers and, as a result, the index indicating the base disappears.
It should also be noted that a number represented in another system (other than the base 10), should not be pronounced in the same way, but by enumerating, from the heaviest weight to the lowest weight, each digit or graphism constituting this number.
2. - THE BINARY NUMERATION
This system uses the same rules as the decimal numeration.
As its name suggests, it is based on two values represented by the following graphics {0, 1}.
The numeration at base 2 uses, for the representation of the numbers, the position occupied by the number in the number and gives to this position a previously defined weight.
We find the three main points used also in decimal, that is to say :
graphics
the weighting
the numbering base.
In this kind of representation of numbers, the numeration with base 2 is the simplest system, therefore the one that the machine can best interpret since it contains only two symbols.
On the other hand, it does not present a great advantage as regards the contraction in the figuration of the numbers.
Example : 19 in decimal is written in binary (that is to say in base 2) : 10011.
This same quantity is represented by two graphics in base 10 whereas it takes 5 in base 2.
Figure 3 illustrates the representation of numbers in 2-based weighted counts.
To find the decimal equivalent of the binary number 101101 of the example of Figure 3, the decimal value of the weight occupied by the rank of each of these digits is taken for each binary. Then add each partial result. This sum corresponds to the equivalent decimal number.
In this case, 2^{5} + 2^{3 }+ 2^{2 }+ 2^{0} is 32 + 8 + 4 + 1 = 45. The decimal number 45 is the equivalent of the binary number 101101.
The base is a kind of container. To measure a given quantity, the larger the container, the smaller the number of containers counting, or containing, that quantity.
So, if you only use four different ranks or weights :
in base 2, we can count from 0 to 15_{10} (from 0 to 1111_{2}) while in base 10, we can count from 0 to 9999_{10}.
In digital systems, one has to transform binary into decimal or inverse.
For this reverse operation, it is also possible to use the table of Figure 3.
Or to transpose the number 27 into its binary equivalent.
This number is broken down by the sum of the binary weights (noted in decimal) contained in this number. Each of these weights is transposed into binary (using the table, Figure 3) and the sum is carried out (Figure 4).
27 = 16 + 8 + 2 + 1
Another method is to divide 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 highest rank number of the binary number thus obtained.
Or to transpose 29_{10} in binary. Figure 5 explains this alternative method.
As in the decimal system, 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 ranks is represented by the number corresponding to the number base affected, by exponent, of the chronological order of the rank preceded by the negative sign.
Negative exponents correspond to fractions, hence the name of fractional numbers.
Examples :
Figure 6 shows the procedure for writing a fractional number in binary.
Binary numbers are, for us, difficult to manipulate and complicated to read. When a dialogue is to be established between the technician and the machine, the coding of the binary information is used. For example, the BCD (Decimal Coded Binary) code makes it easier to read or transpose information.
This code only uses the binary numbers 0000 to 1001 (0 to 9_{10}).
Each group of four bits (bit = binary digit = chiffre binaire) represents from the right its decimal equivalent and the weight assigned to its rank.
The lowest weight is always the rightmost.
Example : 99_{10} is written in pure binary 01100011.
In BCD, it becomes :
99 in decimal is written in BCD : 1001 1001.
In short, it is the decimal representation system but we replace the decimal digits with their binary equivalents.
3. - HEXADECIMAL AND OCTAL NUMERATIONS
In some machines, when it is necessary to enter data, another number base is used. This is hexadecimal (base 16).
Figure 7 gives the equivalence for the first 32 numbers between decimal, binary, hexadecimal and octal.
16 in number. They are :
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }
This notation simplifies the representation of numbers.
Errors when transposing the technician information (hexadecimal) to the machine (in binary) are considerably reduced.
This requires, inside the machine, a hexadecimal translation system in binary (and vice versa), because if the digital circuits can interpret several languages, they "think" in binary.
Example : the number 255_{10} is written in hexadecimal : FF (while written in binary : 11111111).
This avoids the writing of a large number of graphics, thereby eliminating errors of inattention.
Continuing along this path, it is enough that the interpreter is able to understand a language close to the spoken language and the dialogue with the machine is considerably simplified. This is the orientation that has been given for some years now for computers and so-called "advanced" languages.
The numeration base 8 is also used in digital electronics, it is designated under the term : Octal.
The graphics that this number uses are :
{ 0, 1, 2, 3, 4, 5, 6, 7 }
The representation of the numbers in this numeration is done in the same way as for those described previously ; it uses position numeration.
We will dwell a little on these codes and take an example.
Or to transpose the decimal number 99 in binary, octal then hexadecimal.
To transform a decimal number into pure binary, it is necessary to break this number into powers of 2.
Let's take a look at Figure 8 which groups the powers of 2, from 0 to 20.
We will look for what is the largest power of 2 fully included and once in the decimal number.
2^{7} = 128 is not contained in 99.
2^{6} = 64 is contained in 99.
But 64 does not correspond entirely to 99, there is a remainder : 99 - 64 = 35.
We continue to search the power of 2 content in 35 :
2^{5} = 32 is contained in 35.
We look for the rest and continue the process until the rest is zero.
35 - 32 = 3
2^{1} = 2 is contained in 3.
Rest : 3 - 2 = 1
2^{0} = 1 is contained in 1.
Rest : 1 - 1 = 0. We obtain as follows :
99 = 2^{6} + 2^{5} + 2^{1} + 2^{0}
The power of 2 indicates the rank corresponding to the bit weight contained entirely and once in the decimal number considered. That is why we will place a 1 (binary) at the place of the rank indicated in superscript (see Figure 3). This is achieved Figure 9.
We have just transposed a decimal number to its binary equivalent.
To go from decimal to octal, there is a simple way to go through the binary.
The binary number, the equivalent of the decimal number, which one wishes to transform, is divided into three-digit slices starting from the right. Each three-digit group represents a new number. Each of these numbers is transposed into as many octal digits, all of these digits being the equivalent octal number.
Adding two zeros to the top of the binary number does not change the number.
Why break the binary number into three-digit slices ?
Because base 8 corresponds to an integer power of 2 (thus base 2), in fact, 8 = 2^{3}. In base 8, the graphics or figures that can be attributed to the ranks range from 0 to 7. To get these numbers in binary, you need to have three ranks :
It is clear that three ranks, or consecutive weights to represent the seven figures of the octal system, are necessary and sufficient.
To transform a decimal number into a hexadecimal number, we use the same method of passing through the binary. Hexadecimal is also an entire power of the system based 2. But since the graphics are 16, we cut the binary number in increments of 4 digits that will be transposed into hexadecimal digits to obtain the hexadecimal number.
Any numbering system whose base corresponds to an integer power of 2, can use the same procedure. For example, for a 32-based system (2^{5}), the binary number is split into 5-digit slices. we obtain :
Let's group our results : 99_{10} → 1100011_{2} → 143_{8} → 63_{16} → 33_{32}
In this example, the hexadecimal number does not have a letter. We saw in Figure 7 that this system beyond 9 included the letters :
A, B, C, D, E, F
These letters are essential because there are no figures provided in this case. One could very well invent, any design would do, but in digital electronics (microprocessor instructions), they are used officially. Moreover, they should be given a pronunciation.
Let's see an example using these letters. Or to transpose 234_{10} to its equivalent in base 16 (hexadecimal). Figure 10 first gives the flow of operations for the passage in binary.
Let's split the resulting binary number into four-digit slices.
The number 234_{10} is equivalent to the hexadecimal numbe : EA.
The number 255_{10} is equivalent to the hexadecimal number : FF.
This way of representing a number with letters can seem surprising, but if you realize automatisms with microprocessors, you will have to enter the instructions in hexadecimal and this notation will appear then natural to you.
This way of splitting the binary number into n digit slices to get the equivalent in another base, integer power of 2, is not applicable for base 10, or decimal (10 is not an integer power of 2).
To represent the ten figures of this base, we must, despite everything, four ranks of binary weight. These are, therefore, poorly exploited since they allow the representation of the sixteen symbols.
The decimal symbols, from 0 to 9, use the bit combinations from 0000 to 1001.
Click here for the next lesson or in the summary provided for this purpose. | Top of page |
Previous Page | Next Page |
Send an email to Corporate Webmaster for any questions or comments about this Web Site.
Web Site Version : 11. 5. 12 - Web Site optimization 1280 x 1024 pixels - Faculty of Nanterre - Last modification : JANUARY 02, 2020.
This Web Site was Created on, 12 JUNE 2019 and has Remodeled, in JANUARY 2020.