0 ratings0% found this document useful (0 votes) 264 views22 pagesNumber System
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
Jil Introduction
pana ie ay oe to understand because the design and
sain the decimal number systom which ipon'the number systems. We are familiar
is used in our day-to-day work. The computer,
however, does not use the decimal number system. It uses the binary ber
system which has base 2. This base 2 system uses only two digits, namely
4, Auser who works on a computer is allowed to use decimal digits 0, 1, 2, ..
letters A, B, C, ..Z, a,b, ¢, .. z, usual special symbols, +,~.
for his convenience. The decimal digits, letters, special symbols etc. are converted
to binary codes in the form of 0's and 1's within the computer. To understand the
operation of a computer a knowledge of binary, octal and hexadecimal number system
is essential. This chapter deals with these number systems.
Number Systems
em in which different numbers can be represented by
ple used to count with the help of stones, fingers,
t adequate. Nowadays, numbers are represented
.d their specific weights.
Number system is a syst
different ways. In early days, peo}
sticks etc. These miethods were no!
depending upon the position of digit an
ber system of base (or radix)
Pe ce .
¥ |=! Definition :
4. Number System : Anum
|
| |
| risa system that uses different symbols for representing |
| r different digits. |
! 2. Base or Radix : The base of the number system is the |
pols or digits used in it. ,
number of different sym|r-
1.2.1 Types of Number Systems
There are two types of number systems :
(a)
(bo)
(a)
(b)
Non-positional number systems
Positional number systems
Non-positional number systems
In non-positional number system the position of the symbols OF digits is ng
fixed. One example of a non-positional number system is Roman numba
system. This system has symbols such as | for 1, Il for 2, Il for 3, IV for 4, y)
for 5 etc, But, there is no symbol corresponding to zero. Due to absence o
zero, this system is quite inefficient. Arithmetic calculations are very difficuy
when such systems are used. For example, it is very difficult to us if we want
to multiply XI by VII.
Positional number systems
In positional number systems, the value of each symbol is determined by its
position. For example, the 4 in 400 has a different value than 4 in 40000.
Hence the value of each digit (or symbol) in a number depends upon the
following:
(a) The face value of the digit
(b) The base of the number system
(c) The position of the digit in the number.
One example of positional number system is our familiar decimal number
system. In decimal system, there are 10 symbols (0, 1, 2, 3, )). Since it
has ten symbols, it has a base (or radix) of 10. Every positional number system
has a base or radix. The base of a number system is defined as number of
different symbols it recognizes. All number systems have the highest
numerical symbol having a value one less than the base. Other number ‘systems
of our interest are binary, number system, Octal number system and
Hexadecimal number system having base of 2, 8,and 16 respectively.
N
1. Thi igi i
7 e largest digit or symbol in a positional number I
system is one less than its base. I
2. The smallest digit or symbol in a positional number |
system is always zero. I
eet aa 7The table 1.1 shows the various number systems with their base and different
symbols.
TABLE 1.1
Number System Base or Radix Digits or Symbols
Decimal’ _ 19% 0,1,2,3,4,5,6,7,8,9
Binary 72 0,1
Octal 8 0,1, 2,3, 4,5, 6,7
Hexadecimal 16 0, 1,2, 3,4, 5, 6, 7,8, 9%
7 A,B, C,.D, E, F
= _
1.3. Decimal Number System
We use the decimal number system in our daily pie ein unique digits (0, 1, 2,
pm 9) and its base is 10. Let us consider a decimal number §4219.328, This number
can be represented as. 3
Position 5x10°+ 4x109+ 2x10?+ = 1x10'+ 9x10" 3x10" 2x107 + 8x10*
of digits en aes
10000th 1000th 100th = Tenth Unit To 700 000
The left most digit in a number is known as Most Significant Digit (MSD). It is 5 in
our example. The right most digit, namely 8, is the Least Significant Digit (LSD).
Thus a decimal number. which has n digits in its integer part and m digits in its
fractional part can be represented as.
d,x10™t +d, x 10"? +...
+0_,x107%+d_,x 10%+.
.+d,x10°+d_,x 107
dx 10
In general a number with base r which has n digits in its integer part and m digits in
its fractional part can be represented as
darted e+ ded isd ret td, om
Here d, is the most significant digit & d_,, is the least significant digit of the number.
1.4 Binary Number System
In computers, binary number system is used which has base 2 with digits Oor 1.
The 0 and 1 of the binary system are referred to as bits (which is an abbrevated
form of the expression binary digits).1.4.1 Necessity of Binary Number System
The reasons are :
1. Electronic components by their nature, operate in a binary mode. A switch ig
either on (1 state) or off (0 state); a transistor is either conducting (1) or non.
conducting (0).
2. Computer circuits have to handle only two binary digits (bits) rather than 10,
So, binary system simplifies the design, reduce the cost and improve the
reliability of computer system.
3.
Everything that can be done with decimal system can also be done in binary
system.
The binary numbers can be converted into decimal numbers and decimal into binary
numbers. A binary number having n bits in its integer part and m bits in its fractional
part can be changed to decimal number by the formula :
d, 244d, 274 wt d, 4d 24d 224 dO
Where d, is the most significant bit and _,, is the least significant bit of the binary
number.
For example, a binary number 1010 (written as (1010),) is represented in decimal
number as : :
(1010), = 1x 2°+0x2?4+1x2'+0x 2
=8+04+2+0=10
Thus, the binary number (1010), is equal to the decimal number (10). o
Octal Number System
Octal number system has a base of 8 and it uses the digits 0, 1,2,3, 4,5 6, 7. The
values assigned to the consecutive Places in the sytems are
1,8,
8°, 8, 8, 8°, &
; E .
Where 8° place is the unit place. The octal numbers can be converted
into decimal numbers and vice-versa, *
14]1.6
1.7
For example, decimal equivalent of octal number (2057), is :
(2057), = (2 x 8°) + (0 x 8%) + (5 x 8") + (7 x 8°)
= 1024+0+40+7=1071
Therefore, (2057), = (1071),,.
Hexadecimal Number System
Hexadecimal system has a base of 16 and it uses the digits 0,1,2,3,
B,C, D,E, F.
6,7,8,9, A,
The values assigned to the consecutive places in the system are ...
16°, 16-1, 16-2.
The Hexadecimal number can be easily converted into decimal numbers and vice-
16°, 16%, 16",
where 16° place in the unit place.
versa.
For example, decimal equivalent of Hexadecimal number (IAF),, is :
(AF), = 1x 162+ Ax 161+ Fx 16° i
= (1 x 256) + (10 x 16) + (15x 1)
= 256 + 160+ 15=431
Conversion of Integer Decimal Number to a Number
in Another Base
The following steps are used to convert a integer decimal number to a number in
another base.
1. . Divide the given decimal number by the value of the new base.
2. Record the remainder from step 1 as the least significant digit (LSD) of the
new base number.
3. _ Divide the quotient again by the value of new base.
Record the remainder as the next significant digit.
steps 3 and 4 and record the remainders until the quotient‘becomesExample 3.1
Convert the
() 25, (i) 124
Solution :
@
oiowing decimal numbers into binary :
..Least significant digit
..Most significant digit
(iy
pi
Thus (121),, = (1111001),
Example 1.2
Convert the following decimal numbers to octal number
() 125 (i) 952
Solution :
16]@
Remainders
‘Thus (952),. = (1670),
Example 1.3
Convert following decimal numbers to hexadecimal numbers.
@) 238
(i) 7547
Solution :
(i) 16 238 = ~=Remainders
14(E)
Thus (238),5-= (EE);5
(i) 16 7547 - Remainder
Thus (7547), = (1D7B),5Example 1.4
Convort (135),, to baso 4.)
Solution :
4 135 — Romaindors
4 33 3
a | 8 1
4 2 Qo
a 0 2
Therofore (135), = (2013),
1.8 Conversion of Fractional Decimal Number to a Numbe!
in Another Base
Following steps are used to convert a fractional decimal number to a number ii
another base.
1, Multiply the given decimal fractional by the value of the new base.
2, Record the integral (or carry) part of the product as the most significant digi
(MSD) of new base fractional. ;
3, Multiply the fractional part of the product by the value of the new base.
4, Record the Integral (or carry) part of the product as the next significant digit.
5. Repeat steps (3) and (4) until the fractional part of the prduct becomes zero 0
we get the previous or repeated fractional part, Record the last Integral (0
carry) part of the product as the leggtsignificant digit (LSD) of new bas?
fractional.
(8)Examplo 1.5
Convort tho following docimal fractlonals into binary
+ () 625, (ll) 6
Solution : —
0) 6254
Carry 2
1 250
2
0 500
2 -
1 .000 ;
Thus (.625)19 = (101),
(ii) 6
Carry 2
1 2
2
0 4
ee
0 8 :
aoe ee
1 6
Observe that we have found the same fractional .6, therefore, this lead to &
nonterminating binary fraction.
Hence (.6),. = (,1001 (1001),
4
recurring ae
We can also write nomennicai binary fraction as:
(8)y0 = (.6)yo = (1001 700%),a
Example 1.6
inal
Convert the decimal number 116.5625 to: Cee
: ’
Solution :
(i) Integral Part
2° 116 Remainders
Thus (116), = (1110100), we(1)
(il) Fractional Part
No 5625
Carry 2
1 « .1250 ot
2 2
° +2500 s
s 2
Oe goog
——
u -0000 :
Thus (.5625),, = (1001),
from (1) and (2)
(116.5825). = (1110100,1991) ae
e inExample 1.7
Convert the following decimal numbers to octal number.
(i) 0.625, (ii) 225 225
Solution :
(i)
625
Carry 8
5 000
Thus (.625),, = (.5),
(i) (@) Integral Part (225)
225 _ Remainders
Thus (225) = (341),
(b) Fractional Part (.225)
.225
Carry 8
1 -800
8
6 -400
8
3 .200
8
1 600
pe bey ee Bs
4 800
Thus (.225),, = (16314 (6314),
Recurring
Hence, (225.225),.= (341.16314(6314)),
(1 ‘naeExample 1.8
Convert following decimal numbers to hexadecimal numbers.
@) 03
(ii) 225.225
Solution :
@ 3
Carry 16
4 8
16
(C12 8
16
(oy12 8
Thus (0.3);) = (40
Recurring
(il) (a) Integral Part (225) i
Remainders
225
14(E)
Thus (225) 19 = (Et)5
(b) Fractional Part (.225)
225
Carry 16
4 000.
(228) 19 = (-4)46
ie
‘Thus (225.225),, = (E1.4),
[12]1.9 Conversion From Another Base Number to Decimal
Number
The Following steps are used to convert a number In any other base to a decimal
number.
4. Determine the positional value of each digit according to the position of the
digit and the base of the number system.
2. Multiply the obtained positional value of step 1 by the respective digit.
3. Sumup the product calculated in step 2. The total is the equivalent value in the
decimal.
Example 1.9
Convert the following binary numbers into decimal form
(i) 110 (i) 10101010 (iii) 100.001
Solutions :
@ (110), = 1x2? + 1x2" + 0x2?
= 4 +240
a © Nba SW
Hence (110). = (6) = [EOD
1x27 + Ox25 + 1x25 + Ox24 + 1x29 + 0x22 41x21 + 0x2?
128 404+32+0+8+0+240
170
(i) (10101010),
(ii) (1100.001), 1x23 + 1x22 + Ox2" + 0x29 + Ox2 + Ox2? + 1x29
1
= 8444040404045
= 12.125
Example 1.10
Convert the following octal numbers to decimal numbers
(i) 305 (ii) 7532.625
Solution :
@ ~ (805), ve
8x82 + 0x8! + 5x8?
192+ 0 + 5
197 ©
wow
[13]| Ny
1 2x89 + EXE 2x8-2 4 5
_ 3 4. 5x82 + 3x8! + xB
(i) 7592,.625 = 7x8 + 75 + 0.03125 + 0.0
= yp0d + 920+ 24 42 + 0.7 97854,
= 3930.791015625
= 3930.791
Example 1.11
Convert the following hexadecimal numbers into theirdecimal equivalents;
() @FA.8),,
(i) (SBFC),,
Solution : 4
(i) (BFAB),, = 3x16? +Fx16! + Ax16? + 8x16
= 3x256 + 15x16 + 10x1 + 16
= 768+240+10+0.5
= 10185
Thus (3FA.8),5 = (1018.5);o
3x16? + Bx16? + Fx16' + C x16°
= 3x4096 + 11x 256 + 15x16 + 12x1
= 12288 + 2816 + 240 +12
= 15356
Thus (3BFC),_-= (15356),
(i) BFC),,
Example 1.12
Solve (3012), = (?),,
Solution :
(3012), = 3 x 69+ 0x6? +1x6'+2 x60
=64840+6+2
= 656
There (3012), = (656),,
~
ight i it i leger pay 5
left to right in the binary fractional part. These ee Of the binary number and ie
octal equivalents as shown in the table 1.2) IPS Of three. are replaced bY tne
4 flTABLE 1.2
Decimal Number Octal Number Binary Number
0 0 000
1 1 001
2 2 010
3 ee 011
4 4 100
5 5 101
6 6 110
it 7 111
4 2]
ey, } g
Example 1.13 yrk 64 38 5
Convert the following binary number to octal numbers
(i) 101111 100 i 001110
(i) 1110001010 (iv) .1011
(v) 11110000101 (vi) .11001 (vii) 1010.1010
Solution :
() (101 111 100), 101 111 100
5 7 4
= (574),
(i) (001110), = 001 110
wm }
= a 6 »
= (18),
1 110 001 010
www
(iii) (1110901010),
As the leftmost group consists of only one bit, this group is extended by adding
zeros in MSBs.
001 110 001 010
ewe ee
1 6 1 2
(1612),
101
em me
(111 000 1010),
out
(iv) 1011As the rightmost group consists of only one bit, this group is extended by adding
1e
zeros in LSBs.
1011 7 Se ey
: a
= 5 4
= (54),
011 110 000 101
nee
6 0
(¥) (11110000101),
7 3 :
= (8605),
(wi) (11011), = 110 110 (Note)
ww ewe
: 6 6
= (66),
(vil), 1010.1010 001 010 .101 000 (Note)
a een een
1 2.7 5 19
(12.50),
Example 1.14
Convert the following octal numbers into their binary equivalents :
A) 305 (il) 225,34
Solution :
Replace each octal digit by a set of three binary digit and group these together.
@ (305), = 3.0 5
woe
011 = 000 101
= (011000101),
= (11000101),
(i) 225.34 = 2 2 5 3 4
www ee
= 010 010 101.014 100
(010010101.011 100),
(10010101.0111),
j16)1.11 Conversion of An Hexadecimal Number into Binary
and Vice-Versa
Since its base is 2‘= 16, therefore, every hexadecimal digit can be represented as
a group of 4 bits as shown in table 1.3,
TABLE 1.3
Decimal Number Hexadecimal Number Binary Number
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0169
5 5 0101,
6 6 0110 ~
7 7 O111*
8 8 1000 ,
9 9 1001
10 A \. 10107
1 B 1014" -
12 c 1100 ,
13 D 1101
14 E 1110
15 ys eG F 1114
Example 1.15.
Convert the following binary numbers into their hexadecimal ¢ equivalents :
@ 10110 ;
Ail) 110101.1101
(ii) 0.10110
Solution :
() (10110), a 0001 0110
wn ee
= 1 6
it © M86
[17](ii) (110101 1101), ott 0101. 1101
= de a
gee
= (35.D)i6
: = 0.t011 0000
(ii) 0.10110 eas
= B 0
= (0.80),
= (0.B) 5
Example 1.16 i
Convert the following hexadecimal numbers into their binary equivalents.
() A4.B (BCE
Solution :
@ (A4. By, = A 4 B
ww ee ee
7 1010. 0100 1011 a
= (10100100.1011), »
(i) IBCE .
1 B Cc ES
nw ~~ Bn
5 9001 1011 4400 4110
(14011 11001119),
1.12 Conversion of An He
Number and Vice-Ve;
xadecimal Numi
Steps are :
Tsa
1. Convert the Source number toa bin, ary numb
i 2. Convert the binary number so op, mber,
zg Obtained to the target
aplExample 1.17
Convert the hexadecimal number 4AB to its equivalent octal number.
Solution :
The hexadecimal number is first converted to its binary equivalent
4AB = 0100 .1010 1011
(010010101011),
Now the above binary equivalent is divided into groups of 3 bits to obtain its octal
equivalent
\
010010101011 = 010 010 101 O11
wee a
2 2 5 3
= (2253),
Hence (4AB),, = (2253), .
wd
Example 1.18
Convert the octal number 4 5 7 to its equivalent hexadecimal number
Solution :
(457), (100) (101) (111)
= (100 101 111),
Now, make the groups of 4 bits to obtain its hexadecimal equivalent, we get
(100101111) = 0001 0010 1111
enn me
1 c F
12F
Hence (457), = (12F)15
Exercise
1, Convert the following binary numbers into their decimal equivalents
(i), 1001 (i) 1101101
(iii) 100110011 (iv) 110110110110
(v) 11010.11 QF 11011.011 — ga.4ag
(vil) 10110 ( :
[19]10.
WwW.
12.
fer]
to binary:
Convert the following decimal numbers in!
qi) 144
5 eis (iv) 221.1875
Aili) 109,
17.3
co the following octal numbers into their decimal equivalents
) 267.25 (i) 529.23
(ii) 1633.05 wy) eee bi
Convert the following decimal numbers into their oct ae alent
i - i) 438,
Ai) 153.25 (
(ii) 690.625 (iv) 1692.025
(v) 267.96 %
Convert the following binary numbers into their octal equivalents.
() 101 101 101.107 (ii) 2101 00114 01 0011. tone
Ail) 1101011.10101 193.52 Ta
Convert the followin,
ig octal numbers into their binary equivalents,
(i) 251.25
(i) 1527.362
Convert the following hexadecimal numbers into their decimal equivalents,
(i) 1096.4 (i) 2aF.A
(ii) ABC.2 (iv) 7AQ
Convert the followin,
@ 101001101104 i) 199404
iii) 1011100.1000101 “se13.
Solve the following :
(i) (130) = (?)5
(if (1000)3 = ()i9
(ii) (8776)4 = (2),
(iv) (22011), = (?)10
(Vv) (6677)19 = (?)5
(vi) (241401), = (?)16
(vil) (8554)19 = (2)
(vill) 221) = (710
“\
Answers
@. 9 (ii) 109
(ii) 307 (iv) 3510
(v) 26.875 (vi) 27.375
(vii) 22
(i) 10011 qi) 1101111
(fii), 1101101.001
(v) 10001.01001 (1001)
(i) 183,328125
(iii) 923.077
Ai) 231.2
(iii) 1262.5
(v) 413.(7534121727024365605)
(i) 555.5
(iil) 153.52
(i) 10101001.010101
(i) 4246.625
Alli) 27481250
(i) 149F
(iil) 1096.4
() A6D
(ll) 5C.8A
(I), 1010 1011 1100
(il) 10 1011 0011 1100 0100 1111.0101.
(iv) 11011101.0011
(i) 345296875
(iv) 174,724609375
(i) 666.1
(iv) .3234.01463 (1463)
(i) 24723.54
(i) 1101010111.01111001
(ii) 687.625
(iv) 1961
(i) 416.4
(iv) 4D2.¢
(i) 3D
(W~ 1011 1100 11011 110. 101
[21]12.
Decimal Hexadecimal
1001110 4
111011
11111010
01011111
13. (i) (11211),
Ai Oo
(ii) (2021020),
(iv) 645),
(v) (203202),
(vi) (8976),,
(vii) (100334),
(vill) (85),
Q00
[22]