0% found this document useful (0 votes)
45 views

Chapter 5 - Computer Number Systems

good for revision

Uploaded by

allankinuthia68
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

Chapter 5 - Computer Number Systems

good for revision

Uploaded by

allankinuthia68
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

UCC103 – PRINCIPLES OF COMPUTING

Chapter 5: Computer Number Systems

5.1 Introduction to Digital Systems


Electronic circuits/systems are classified as being analogue or digital, the distinction between the
two circuits is not the semi-circular material used to construct them but rather the way they are
operating, that is Current and voltage variations during performance. 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. By contrast, the digital circuit is the one which
voltage levels alternate among a finite number of distance value that is, they are 2 voltage levels
high a low.

Digital circuits produce discrete outputs, distinct circuits have individual components e.g.
resistors, and transistors. Hybrids circuits contain both integrated and discrete components.
Digital circuits are often called logic circulatory because the level of each output voltage
depends on several input voltages and the inputs voltage may appear in many different
combinations.

5.2 Number Systems.


Number System- A number system defines a set of values to represent quantity. We talk about
the number of people attending a class, the number of modules taken by each student and use
numbers to represent grade.

Number System can be categorized in two systems:-


a) Non-Positional Number System- In ancient times, people used to count on fingers, when
the fingers became insufficient for counting, stones, pebbles or sticks were used to indicate
values. But it was very difficult to perform arithmetic with such a number system as there is
no symbol for zero.
b) Positional Number System- In this system the value of each digit is defined not by the
symbol but also by the symbol position. Positional Number System is used to perform
arithmetic. Existing Positional number system is decimal number system. Apart from the
decimal number system, there are binary number system, octal number system and
hexadecimal number system.

The base of a number system is indicated by a subscript (decimal number) and this will be
followed by the value of the number. For example (952)10, (456)8, (314)16

Number System that are used by the computers-


 Decimal System
 Binary System
 Octal System
 Hexadecimal System

Numbers are difficult to define, they are simply a symbolic representation of ideas; number
systems are positional in nature and therefore a symbolic of numbers has weights.

Introduction to Computers. Chapter 5: Computer Number Systems Page 1


5.3. Decimal Number System
The decimal system is the system which we use in everyday counting. The number system
includes the ten digits from 0 through 9 (0 – 9). These digits are recognized as the symbols of
the decimal system and are thus called decimal digits. The position of each digital has a
numerical weight and each digital is a multiplier of the weight of its position e.g. 102, 101 ,100 –
weights. When our count exceeds the highest digit available, the next digit to the left is
incremented and the original digit is reset to zero. For example:
910 + 110 = 1010

Each digit in a base ten number represents units ten times the units of the digit to its right. For
example-
954210 = 9000 + 500 + 40 +2 = (9 × 103) + (5 × 102) + (4 × 101) + (2× 100)
13010 = 100 + 30 + 0 = (1x102) + (3x101) + (0x100)

Because we are dealing with a base-10 system, each digit to the left of another digit is weighted
ten times higher. Using exponential notation, we can imagine the number 10 as representing:

5.4. Binary Number Systems


Computers do not use the decimal system for counting and arithmetic. Their CPU and memory
are made up of millions of tiny switches that can be either in ON and OFF states. 0 represents
OFF and 1 represents ON. The number system includes the two digits from 0 and 1(0,1).
Counting Similar to decimals, binary digits have a positional weight. Each bit is weighted twice
as much as the bit to the right of it

5.5. Octal Number System


The octal system is commonly used with computers. The name octal implies eight; octal number
system has a radix of eight and uses the following 8 digit 0,1,2,3,4,5,6, and 7 has base 8. The
octal system uses a power of 8 to determine the digit of a number’s position.

5.6. Hexadecimal System


Hexadecimal System- Hexadecimal is another number system that works exactly like the
decimal, binary and octal number systems, except that the base is 16. Each hexadecimal
represents a power of 16. The system uses 0 to 9 numbers and A to F characters to represent 10
to 15 respectively.

5.7. Number Systems Conversions


Any number in one number system can be converted into any other number system. There are
the various methods that are used in converting numbers from one base to another.

Introduction to Computers. Chapter 5: Computer Number Systems Page 2


Decimal Binary Octal Hexadecimal
Number Number Number Number
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F

5.8. Conversions of Decimal to other Number System


a). Decimal to Binary- The method that is used for converting of decimals into binary is
known as the remainder method. We use the following steps in getting the binary number-
1) Divide the decimal number by 2.
2) Write the remainder (which is either 0 or 1) at the right most position.
3) Repeat the process of dividing by 2 until the quotient is 0 and keep writing the remainder
after each step of division.
4) Write the remainders in reverse order.

Example- Convert (45)10 into binary number system.

Remainder
2 45 1
2 22 0
2 11 1
2 5 1
2 2 0
2 1 1
0

Thus (45)10 = (101101)2

Note- In every number system-


 The first bit from the right is referred as LSB (Least Significant Bit)
 The first bit from the left is referred as MSB (Most Significant Bit)

Introduction to Computers. Chapter 5: Computer Number Systems Page 3


b). Conversion of Decimal to Octal- In converting decimal to octal, we follow the same
process of converting decimal to binary. Instead of dividing the number by 2, we divide the
number by 8.
Example- Convert (45)10 into octal number system.

Remainder
8 45 5
8 5 5
8 0

Thus (45)10 = (55)8.

c). Conversion of Decimal to Hexadecimal- We divide by 16 instead of 2 or 8. If the remainder


is in between 10 to 16, then the number is represented by A to F respectively.

Example- Convert (45)10 into hexadecimal.


Remainder
16 45 D
16 2 2
0

Thus (45)10= (2D)16.

5.8.1. Conversion of Decimal Fractions


Conversions of Decimal Fractions to Binary Fractions- For converting decimal fractions into
binary fractions, we use multiplication. Instead of looking for a remainder we look for an
integer. The following steps are used in getting the binary fractions-
1) Multiply the decimal fraction by 2.
2) If a non-zero integer is generated, record the non-zero integer otherwise record 0.
3) Remove the non-zero integer and repeat the above steps till the fraction value becomes 0.
4) Write down the number according to the occurrence.

Example- Find the binary equivalent of (0.75)10.


Number (to be recorded)
0.75 × 2 = 1.50 1
0.50 × 2 = 1.00 1

Thus (0.75)10= (0.11)2.


Moreover, we can write (45.75)10= (101101.11)2.
Remark- If the conversion is not ended and still continuing; we write the approximation in 16
bits.

Example- Find the binary equivalent of (0.9)10.


Number (to be recorded)
0.9 × 2 = 1.8 1

Introduction to Computers. Chapter 5: Computer Number Systems Page 4


0.8 × 2 = 1.6 1
0.6 × 2 = 1.2 1
0.2 × 2 = 0.4 0
0.4 × 2 = 0.8 0
0.8 × 2 = 1.6 1
0.6 × 2 = 1.2 1
0.2 × 2 = 0.4 0
0.4 × 2 = 0.8 0
0.8 × 2 = 1.6 1
0.6 × 2 = 1.2 1
0.2 × 2 = 0.4 0
0.4 × 2 = 0.8 0
0.8 × 2 = 1.6 1
0.6 × 2 = 1.2 1
0.2 × 2 = 0.4 0
0.4 × 2 = 0.8 0
0.8 × 2 = 1.6 1
Thus (0.9)10 = (0.111001100110011001)2.

Conversions of Decimal Fractions to Octal Fractions –We follow the same steps of
conversions of decimal fractions to binary fractions. Here we multiply the fraction by 8 instead
of 2.
Example- Find the octal equivalent of (0.75)10.
Number (to be recorded)
0.75 × 8 = 6.00 6

Thus (0.75)10= (0.6)8.


And (45.75)10= (55.6)8.

Conversions of Decimal Fractions to Hexadecimal Fractions – Here we multiply the fraction


by 16 instead of 2 or 8. If the non-zero integer is in between 10 to 16, then the number is
represented by A to F respectively.

Example- Find the hexadecimal equivalent of (0.75)10.


Number (to be recorded)
0.75 × 16 = 12.00C (12 = C)

Thus (0.75)10= (0.C)16.


And (45.75)10= (2D.C)16.

5.9. Conversions of Binary to Other Numbers


5.9.1. Conversions of Binary to Decimal
In converting binary to decimal, we use the following steps-
1) Write the weight of each bit.
2) Get the weighted value by multiplying the weighted position with the respective bit.
3) Add all the weighted value to get the decimal number.
Introduction to Computers. Chapter 5: Computer Number Systems Page 5
Example- Convert (101101)2 into decimal number system.

Binary Number 1 0 1 1 0 1
Wt. of Each bit 25 24 23 22 21 20
Weighted Value 1 x 25 0 x 24 1 x23 1 x 22 0 x 21 1 x 20
Solved 32 0 8 4 0 1
Multiplication

Thus (101101)2 = (1 × 25) + (0 × 24) + (1 × 23) + (1 × 22) + (0 × 21) + (1 × 20).


= 32 + 0 + 8 + 4 + 0 + 1
= 4510

5.9.1.1. Conversions of Binary Fractions to Decimal Fractions


The conversions of binary fractions to the decimal fractions is similar to conversion of binary
numbers to decimal numbers. Here, instead of a decimal point we have a binary point. The
exponential expressions (or weight of the bits) of each fractional placeholder is 2-1, 2-2………

Example- Convert (101101.11)2 into decimal number system.

Binary Number 1 0 1 1 0 1 1 1
Wt. of Each bit 25 24 23 22 21 20 2-1 2-2
Weighted 1 x 25 0 x 24 1 x23 1 x 22 0 x 21 1 x 20 1 x 2-1 1 x 2-2
Value
Solved 32 0 8 4 0 1 0.5 0.25
Multiplication

Thus (101101.11)2 = (1 x 25) + (0 x 24 ) + (1 x23 )+ (1 x 22) + 0 x 21 + (1 x 20 ) + (1 x 2-1 )+ (1 x


2-2)
= 32 + 0 + 8 + 4 + 0 + 1 + 0.5 + 0.25 = 45.7510

5.9.2. Conversions of Binary to Octal


We use the following steps in converting binary to octal-
1) Break the number into 3-bit sections starting from LSB to MSB.
2) If we do not have sufficient bits in grouping of 3-bits, we add zeros to the left of MSB so
that all the groups have proper 3-bit number.
3) Write the 3-bit binary number to its octal equivalent.

Example- Convert (101101)2 into octal.


Binary Number 101101
3-bit Binary Number sections 101 101
Octal Number 5 5

Thus (101101)2 = (55)8.

Introduction to Computers. Chapter 5: Computer Number Systems Page 6


Example- Convert (1101101)2 into octal.

Binary Number 001101101


3-bit Binary Number Sections 001 101 101
Octal Number 1 5 5

Thus (1101101)2= (155)8.

5.9.2.1. Conversion of Binary Fractions to Octal Fractions


We use the following steps in converting binary fractions to octal fractions-
1) Break the fraction into 3-bit sections starting from LSB to MSB.
2) In order to get a complete grouping of 3 bits, we add trailing zeros in MSB.
3) Write the 3-bit binary number to its octal equivalent.

Example- Convert (101101.11)2 into octal.


Binary Number 101 101 110
Octal Number 5 5 6

Thus (101101)2 = (55.6)8.

5.9.3. Conversion of Binary to Hexadecimal


We convert binary to hexadecimal in the similar manner as we have converted binary to octal.
The only difference is that here, we form the group of 4 bits.

Example- Convert (101101)2 into hexadecimal.

Binary Number 0010 1101


Hexadecimal 2 D
Number

Thus (101101)2 = (2D)16.

5.9.3.1. Conversion of Binary Fractions to Hexadecimal Fractions


We convert binary fractions to hexadecimal fractions in the similar manner as we have
converted binary fractions to octal fractions. The only difference is that here we form the group
of 4 bits.

Example- Convert (101101.11)2 into hexadecimal.


Binary Number 0010 1101 1100
Decimal Number 2 13 12
Hexadecimal 2 D C
Number

Thus (101101.11)2 = (2D.C)16.

Introduction to Computers. Chapter 5: Computer Number Systems Page 7


5.10. Conversions of Octal to Other Numbers
5.10.1. Conversions of Octal to Decimal
We follow the same steps of conversion of binary to decimal. The only difference is that here
weight of nth bit is 8 n-1 instead of 2 n-1.

Example- Convert (55)8 into decimal number system.


Octal Number 5 5
1
Wt. of Each bit 8 80
Weighted Value 5 x 81 5 x 80
Solved Multiplication 40 5

Thus (55)8 = 40 + 5.
= 4510

5.10.1.1. Conversions of Octal Fractions to Decimal Fractions-


The weight of the bit of the fraction placeholder is 8-1, 8-2 …We follow the same steps of
conversion of binary fractions to decimal fractions.

Example- Convert (55.6)8 into decimal number system.

Octal Number 5 5 6
Wt. of Each bit 81 80 8-1
Weighted Value 5 x 81 5 x 80 6 x 8-1
Solved Multiplication 40 5 0.75

Thus (55.6)8 = 40 + 5 + 0.75 = 45.7510

5.10.2. Conversions of Octal to Binary-


We use the following steps in converting octal to binary-
1) Convert each octal digit into 3-bit binary equivalent.
2) Combine the 3-bit section by removing the spaces to get the binary number.

Example- Convert (55)8 into binary.


Octal Number 5 5
3-bit Binary Number 101 101
Binary Number 1011012

Thus (55)8 = (101101)2.

Example- Convert (456)8 into binary.


Octal Number 4 5 6
3-bit Binary Number 100 101 110
Binary Number 1001011102

Thus (456)8 = (100101110)2.

Introduction to Computers. Chapter 5: Computer Number Systems Page 8


5.10.2.1. Conversion of Octal Fractions to Binary Fractions
We follow the same steps of conversion of octal to binary.

Example- Convert (55.6)8 into binary.


Octal Number 5 5 6
Binary Number 101 101 110

Thus (55.6)8 = (101101.11)2.

5.10.3. Conversion of Octal to Hexadecimal


The conversion involves the following steps-
1) Convert each octal digit to 3–bit binary form.
2) Combine all the 3-bit binary numbers.
3) Group them in 4-bit binary form by starting from LSB to MSB.
4) Convert these 4-bit blocks into their hexadecimal symbols.

Example- Convert (55)8 into hexadecimal.


Octal Number 5 5
3-bit Binary Number sections 101 101
Combine the 3-bit sections 1011012

Split number into 4-bit Binary 0010 1101


Number sections
Hexadecimal Number 2 D

Thus (55)8 = (2D)16.

5.10.3.1. Conversions of Octal Fractions to Hexadecimal Fractions


The method of conversion is based on the same procedure that we have discussed in conversions
of octal to hexadecimal.
Example- Convert (55.6)8 into hexadecimal.

Octal Number 5 5 6
Binary Number 101 101 110

1) Combining the 3-bit binary block, we have 101101.110.


2) Grouping them in 4 bit binary form (ignoring the decimal point)

Binary Number 0010 1101 1100


Hexadecimal 2 D C
Number

Thus (55)8 = (2D.C)16.

Introduction to Computers. Chapter 5: Computer Number Systems Page 9


5.11. Conversions of Hexadecimal to Other Numbering systems
5.11.1 Conversions of Hexadecimal to Decimal
We do the conversion of hexadecimal to decimal as we have done the conversion of binary to
decimal. Here weight of nth bit is 16n-1 instead of 2n-1.

Example- Convert (2D)16 into decimal.


Hexadecimal Number 2 D (=13)
1
Wt. of Each bit 16 160
Weighted Value 2 x 161 13 x 160
Solved Multiplication 32 13

Thus (2D)16= 32 + 13 = 4510.

5.11.1.1 Conversions of Hexadecimal Fractions to Decimal Fractions


We do the conversion of hexadecimal fractions to decimal fractions in the similar manner as we
have done the conversion of binary fractions to decimal fractions. Here weight of bit is 16 -1, 16-2
…….
Example- Convert (2D.C)16 into decimal.

Hexadecimal Number 2 D (13) C (12)


Wt. of Each bit 161 160 16-1
Weighted Value 2 x 161 13 x 160 12 x 16-1
Solved Multiplication 32 13 0.75

Thus (2D.C)16 = 32 + 13 + 0.75 = 45.7510.

5.11.2. Conversions of Hexadecimal to Binary


We use the following steps-
1) Convert each hexadecimal digit to its 4-bit binary equivalent.
2) Combine all the binary numbers.

Example- Convert (2D)16 into binary.


Hexadecimal Number 2 D
Binary Number 0010 1101

Thus (2D)16 = (00101101)2 = (101101)2.

5.11.2.1. Conversions of Hexadecimal Fractions to Binary Fractions


We use the same steps of hexadecimal to binary conversion.

Example- Convert (2D.C)16 into binary.


Hexadecimal Number 2 D C
Binary Number 0010 1101 1100

Thus (2D)16 = (00101101.1100)2= (101101.11)2.

Introduction to Computers. Chapter 5: Computer Number Systems Page 10


5.11.3. Conversions of Hexadecimal to Octal
We convert each hexadecimal digit in binary. Combine all the binary numbers. Again group
them into 3-bit form. Convert the 3-bit block in octal.

Example- Convert (2D)16 into octal.


Hexadecimal Number 2 D
4-bit Binary Number 0010 1101
Combined Number 00101101

3-bit Binary Number groups 000 101 101


Octal Number 0 5 5

Thus (2D)16 = (55)8.

5.11.3.1. Conversions of Hexadecimal Fractions to Octal Fractions


We follow the same steps of hexadecimal to octal conversion.
Example- Convert (2D.C)16 into octal.

Hexadecimal Number 2 D (=13) C (=12)


Binary Number 0010 1101 1100

Combining the binary number, we get 00101101.1100=101101.11


Grouping the binary number in 3-bit

Binary Number 101 101 110


Octal Number 5 5 6

Thus (2D.C)16 = (55.6)8.

5.12. Revision Questions


Perform the following Number systems conversions
i. 51210 to Binary
ii. 54678 to Hexadecimal
iii. 101001102 to Octal
iv. 7ADF3C16 to Octal
v. 1001001110102 to Hexadecimal
vi. CB23516 to Decimal

Introduction to Computers. Chapter 5: Computer Number Systems Page 11

You might also like