Number System
Introduction
• One of the first things we have to know is that electronics can be broadly classified into
two groups, viz. analog electronics and digital electronics. Analog electronics deals
with things that are continuous in nature and digital electronics deals with things that
are discrete in nature. But they are very much interlinked. For example, if we consider
a bucket of water, then it is analog in terms of the content i.e., water, but it is discrete
in terms of the container, i.e., bucket. Now though in nature most things are analog,
still we very often require digital concepts.
• Many of us are accustomed with the working of electronic amplifiers. Generally they
are used to amplify electronic signals. Now these signals usually have a continuous
value and hence can take up any value within a given range, and are known as analog
signals. The electronic circuits which are used to process such signals are called analog
circuits and the circuits based on such operation are called analog systems.
• On the other side, in a computer, the input is given with the help of the switches. Then
this is converted into electronic signals, which have two distinct discrete levels or
values. One of them is called HIGH level whereas the other is called LOW level. The
signal must always be in either of the two levels. As long as the signal is within a pre-
specified range of HIGH and LOW, the actual value of the signal is not that important.
Such signals are called digital signals and the circuit within the device is called a digital
circuit. The system based on such a concept is an example of a digital system.
Number System
• There are several number systems which we normally use, such as decimal, binary,
octal, hexadecimal, etc. Amongst them we are most familiar with the decimal number
system. These systems are classified according to the values of the base of the number
system. The number system having the value of the base as 10 is called a decimal
number system, whereas that with a base of 2 is called a binary number system.
Likewise, the number systems having base 8 and 16 are called octal and hexadecimal
number systems respectively.
• With a decimal system we have 10 different digits, which are 0, 1, 2, 3, 4, 5, 6, 7, 8, and
9. But a binary system has only 2 different digits—0 and 1. Hence, a binary number
cannot have any digit other than 0 or 1. So to deal with a binary number system is
quite easier than a decimal system. Now, in a digital world, we can think in binary
nature, e.g., a light can be either off or on. There is no state in between these two. So
we generally use the binary system when we deal with the digital world. Here comes
the utility of a binary system. We can express everything in the world with the help of
only two digits i.e., 0 and 1. For example, if we want to express 2510 in binary we may
write 110012. The right most digit in a number system is called the ‘Least Significant
Bit’ (LSB) or ‘Least Significant Digit’ (LSD). And the left most digit in a number system is
called the ‘Most Significant Bit’ (MSB) or ‘Most Significant Digit’ (MSD). Now normally
when we deal with different number systems we specify the base as the subscript to
make it clear which number system is being used.
Number System
• In an octal number system there are 8 digits—0, 1, 2, 3, 4, 5, 6, and 7. Hence,
any octal number cannot have any digit greater than 7. Similarly, a
hexadecimal number system has 16 digits—0 to 9— and the rest of the six
digits are specified by letter symbols as A, B, C, D, E, and F. Here A, B, C, D, E,
and F represent decimal 10, 11, 12, 13, 14, and 15 respectively. Octal and
hexadecimal codes are useful to write assembly level language.
• In general, we can express any number in any base or radix “X.” Any number
with base X, having n digits to the left and m digits to the right of the decimal
point can be expressed as:anXn-1 + an-1Xn-2 + an-2Xn-3 + …. + a2X1 + a1X0 + b1X-1 +
b2X-2 + …. + bmX-m
where an is the digit in the nth position. The coefficient an is termed as the
MSD or Most Significant Digit and bm is termed as the LSD or the Least
Significant Digit.
Conversion between Number System
• It is often required to convert a number in a
particular number system to any other
number system, e.g., it may be required to
convert a decimal number to binary or
octal or hexadecimal. The reverse is also
true, i.e., a binary number may be
converted into decimal and so on.
Decimal-to-Binary Conversion
Convert 2610 into a binary number.
Solution. Division Quotient Generated remainder
26/2 13 0
13/2 6 1
6/2 3 0
3/2 1 1
1/2 0 1
Hence the converted binary number is 110102.
Decimal-to-Octal Conversion
• Similarly, to convert a number in decimal to a
number in octal we have to divide the decimal
number by 8 repeatedly, until the quotient of
zero is obtained. This method of repeated
division by 8 is called ‘octal-dabble.’ The
remainders are noted down for each of the
division steps. Then the column of the remainder
is read from bottom to top order, just as in the
case of the double-dabble method.
Decimal-to-Octal Conversion
Convert 42610 into an octal number.
Solution. Division Quotient Generated
remainder
426/8 53 2
53/8 6 5
6/8 0 6
Hence the converted octal number is 6528.
Decimal-to-Hexadecimal Conversion
• The same steps are repeated to convert a
number in decimal to a number in hexadecimal.
Only here we have to divide the decimal number
by 16 repeatedly, until the quotient of zero is
obtained. This method of repeated division by 16
is called ‘hex-dabble.’ The remainders are noted
down for each of the division steps. Then the
column of the remainder is read from bottom to
top order as in the two previous cases.
Decimal-to-Hexadecimal Conversion
Convert 34810 into a hexadecimal number.
Solution. Division Quotient Generated remainder
348/16 21 12
21/16 1 5
1/16 0 1
Hence the converted hexadecimal number is 15C16.
Binary-to-Decimal Conversion
• Now we discuss the reverse method, i.e., the
method of conversion of binary, octal, or
hexadecimal numbers to decimal numbers. Now
we have to keep in mind that each of the binary,
octal, or hexadecimal number system is a
positional number system, i.e., each of the digits
in the number systems discussed above has a
positional weight as in the case of the decimal
system.
Binary-to-Decimal Conversion
Convert 101102 into a decimal number.
Solution. The binary number given is 10110
Positional weights 43210
The positional weights for each of the digits are written in italics below
each digit. Hence the decimal equivalent number is given as:
1*24 + 0*23 + 1*22 + 1*21 + 0*20
= 16 + 0 + 4 + 2 + 0
= 2210
Hence we find that here, for the sake of conversion, we have to multiply
each bit with its positional weights depending on the base of the
number system.
Octal-to-Decimal Conversion
Convert 34628 into a decimal number.
Solution. The octal number given is 3462
Positional weights 3210
The positional weights for each of the digits are written in
italics below each digit. Hence the decimal equivalent
number is given as:
= 3*83 + 4*82 + 6*81 + 2*80
= 1536 + 256 + 48 + 2
= 184210
Hexadecimal-to-Decimal Conversion
Convert 42AD16 into a decimal number.
Solution. The hexadecimal number given is 42AD
Positional weights 3210
The positional weights for each of the digits are written in
italics below each digit. Hence the decimal equivalent
number is given as:
= 4*163 + 2*162 + 10*161 +
13*160
= 16384 + 512 + 160 + 13
= 1706910
•
Fractional Conversion
Convert 1010.0112 into a decimal number.
Solution. The binary number given is 1 0 1 0. 0 1 1
Positional weights 3 2 1 0 -1-2-3
The positional weights for each of the digits are written in
italics below each digit. Hence the decimal equivalent
number is given as:
= 1*23 + 0*22 + 1*21 + 0*20 +
0*2-1 + 1*2-2 + 1*2-3
= 8 + 0 + 2 + 0 + 0 + .25 + .125
= 10.37510
Convert 362.358 into a decimal number.
Solution. The octal number given is 3 6 2. 3 5
Positional weights 2 1 0 -1-2
The positional weights for each of the digits are written in italics below
each digit. Hence the decimal equivalent number is given as:
= 3*82 + 6*81 + 2*80 + 3*8-1 + 5*8-2
= 192 + 48 + 2 + .37 + .078125
= 242.45212510
Convert 25.62510 into a binary number.
Solution. Division Quotient Generated remainder
25/2 12 1
12/2 6 0
6/2 3 0
3/2 1 1
1/2 0 1
Therefore, (25)10 = (11001)2
Fractional Part
.625 * 2 = 1.250 1
.250 * 2 = .500 0
.500 * 2 = 1.000 1
i.e., (0.625)10 = (0.101)2
Therefore, (25.625)10 = (11001.101)2
Convert 34.52510 into an octal number.
Solution. Division Quotient Generated remainder
34/8 4 2
4/8 0 4
Therefore, (34)10 = (42)8
Fractional Part
.525 * 8 = 4.200 4
.200 * 8 = 1.600 1
.600 * 8 = 4.800 4
i.e., (0.525)10 = (0.414)8
Therefore, (34.525)10 = (42.411)8
Convert 92.8510 into a hexadecimal number.
Solution. Division Quotient Generated remainder
92/16 5 12
5/16 0 5
Therefore, (92)10 = (5C)16
Fractional Part
.85 * 16 = 13.60 13
.60 * 16 = 9.60 9
i.e., (0.85)10 = (0.D9)16
Therefore, (92.85)10 = (5C.D9)16
Conversion from a Binary to Octal Number and Vice Versa
• We know that the maximum digit in an
octal number system is 7, which can be
represented as 1112 in a binary system.
Hence, starting from the LSB, we group
three digits at a time and replace them by
the decimal equivalent of those groups and
we get the final octal number.
Convert 1011010102 into an equivalent octal number.
Solution. The binary number given is 101101010
Starting with LSB and grouping 3 bits 101 101 010
Octal equivalent 5 5 2
Hence the octal equivalent number is (552)8.
Convert 10111102 into an equivalent octal number.
Solution. The binary number given is 1011110
Starting with LSB and grouping 3 bits 001 011 110
Octal equivalent 1 3 6
Hence the octal equivalent number is (176)8.
Convert 1101.01112 into an equivalent octal number.
Solution. The binary number given is 1101.0111
Grouping 3 bits 001 101. 011 100
Octal equivalent: 1 5 3 4
Hence the octal number is (15.34)8.
Convert 47.3218 into an equivalent binary number.
Solution. The octal number given is 4 7 3 2 1
3-bit binary equivalent 100 111 011 010 001
Hence the binary number is (100111.011010001)2.
Conversion from a Binary to Hexadecimal Number and Vice Versa
• We know that the maximum digit in a
hexadecimal system is 15, which can be
represented by (1111)2 in a binary system.
Hence, starting from the LSB, we group four
digits at a time and replace them with the
hexadecimal equivalent of those groups and
we get the final hexadecimal number.
Convert 110101102 into an equivalent hexadecimal number.
Solution. The binary number given is 11010110
Starting with LSB and grouping 4 bits 1101 0110
Hexadecimal equivalent D 6
Hence the hexadecimal equivalent number is (D6)16.
Convert 111011.0112 into an equivalent hexadecimal
number.
Solution. The binary number given is 111011.011
Grouping 4 bits 0011 1011. 0110
Hexadecimal equivalent 3 B 6
Hence the hexadecimal equivalent number is (3B.6)16.
Convert 9E.AF216 into an equivalent binary number.
Solution. The hexadecimal number given is 9 E.A F 2
4-bit binary equivalent 1001 1110 1010 1111 0010
Hence the equivalent binary number is (10011110.101011110010)2.
Conversion from an Octal to Hexadecimal Number and Vice Versa
1. Conversion from octal to hexadecimal and vice versa is sometimes
required. To convert an octal number into a hexadecimal number the
following steps are to be followed:
2. First convert the octal number to its binary equivalent (as already
discussed above).
3. Then form groups of 4 bits, starting from the LSB.
4. Then write the equivalent hexadecimal number for each group of 4
bits.
1. Similarly, for converting a hexadecimal number into an octal number
the following steps are to be followed:
2. First convert the hexadecimal number to its binary equivalent.
3. Then form groups of 3 bits, starting from the LSB.
4. Then write the equivalent octal number for each group of 3 bits.
Convert the following hexadecimal numbers into equivalent octal numbers.
(a) A72E (b) 4.BF85
Solution.
(a) Given hexadecimal number is A72E
Binary equivalent is 1010 0111 0010 1110
= 1010011100101110
Forming groups of 3 bits from the LSB 001 010 011 100 101 110
Octal equivalent 1 2 3 4 5 6
Hence the octal equivalent of (A72E)16 is (123456)8.
(b) Given hexadecimal number is 4BF85
Binary equivalent is 0100 1011 1111 1000 0101
= 0100.1011111110000101
Forming groups of 3 bits 100. 101 111 111 000 010 100
Octal equivalent 4 5 7 7 0 2 4
Hence the octal equivalent of (4.BF85)16 is (4.577024)8.
Convert (247)8 into an equivalent hexadecimal number.
Solution. Given octal number is 247
Binary equivalent is 010 100 111
= 010100111
Forming groups of 4 bits from the LSB 1010 0111
Hexadecimal equivalent A 7
Hence the hexadecimal equivalent of (247)8 is (A7)16.
Convert (36.532)8 into an equivalent hexadecimal number.
Solution. Given octal number is 36532
Binary equivalent is 011 110 101 011 010
= 011110.101011010
Forming groups of 4 bits 0001 1110. 1010 1101
Hexadecimal equivalent 1 E. A D
Hence the hexadecimal equivalent of (36.532)8 is (1E.AD)16.