Data Representation and Number Systems
Data Representation
· Data Representation refers to the form in which data is stored, processed, and transmitted.
· To represent the computer data, number system is used.
· Number system deals with numbers and their representation in different system.
· Data on a computer system is stored in electrical signals.
· These represent binary data.
· Can be one of two states.
· Here they are represented as a 0 or 1.
· Cannot be anything else.
· A 0 or 1 is known as a bit.
· A bit is the most basic unit of information in a computer
o It is a state of “on” or “off” in a digital circuit.
o Sometimes these states are “high” or “low” voltage instead of “on” or “off”.
NUMBER SYSTEM
– It is a system for representing numeric values or quantities using different symbols (digits).
– It deals with numbers and their representation in different systems.
– Base of a system is equal to the number of symbols used in that system.
– The base is also called the radix of the system.
Type of Number System
In Computer System there are 4 types of number system used. These are –
1. Decimal Number System
2. Binary Number System
3. Octal Number System
4. Hexa-Decimal Number System
(1) Decimal Number System:
In real life we use Decimal Number System. Recently we used.
Base: 10 (Construct numbers combination of 10 digits)
Digits used: 0, 1, 2, 3, 4, 5 ,6, 7, 8, 9
All numbers can be represented by these digits.
Counting just like: 0,1,2, 3 …4,5… 10, 11 ……100, 101 … and so on.
Example: 1234, 4566, 10100, (1234)10, (10100)10
(2) Binary Number System: Used in Computer Machine (Digital Circuits)
Base: 2 (Construct numbers combination of 2 digits)
Digits used: 0, 1 (only 2 digits not allowed other digits)
Example: (111.01)2, (10100)2, (.10100)2, 11112
Counting just like: 0, 1, 10, 11, 100, 101, 110, 111, 1000 … and so on.
Invalid Binary Number: 1111 (Base not indicate therefore it is decimal)
(10100)2 ( digit 2 not allowed in binary number)
(3) Octal Number System: Used in Data Representation
Base: 8 (Construct numbers combination of 8 digits)
Digits used: 0, 1, 2, 3, 4, 5, 6, 7 (only 8 digits not allowed other digits)
Counting just like: 0, 1, 2 … 6,7, 10, 11, 12… 16, 17, 20, 21… and so on.
Example: (111.01)8, (15601)8, (.151)8, 11118
Invalid Octal Number: 1111 (Base not indicate therefore it is decimal)
(1078)8 (8 digit not allowed)
(3479)8 (9 not allowed)
(4) Hexa-Decimal Number System: Used in Data Representation
Base: 16 (Construct numbers combination of 16 digits)
Digits used: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (10 digits) +
A, B, C, D, E, F (6 digits as character form)
(F is largest digit and 0 is smallest digit in Hexa-Decimal)
Here A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15 in decimal number.
Counting just like: 0, 1, .. 9, A, B, …. E, F, 10, 11 …. 30, 31, 20, 21… and so on.
Example: (111.01)16, (F0A9E)16, (.151)16, 111116
Number System Table |
|||
This number system table represents a relationship between decimal, octal, binary and hexadecimal numbers. |
|||
Decimal Number |
Binary Number |
Octal Number |
Hexa-Decimal Number |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
2 |
10 |
2 |
2 |
3 |
11 |
3 |
3 |
4 |
100 |
4 |
4 |
5 |
101 |
5 |
5 |
6 |
110 |
6 |
6 |
7 |
111 |
7 |
7 |
8 |
1000 |
10 |
8 |
9 |
1001 |
11 |
9 |
10 |
1010 |
12 |
A |
11 |
1011 |
13 |
B |
12 |
1100 |
14 |
C |
13 |
1101 |
15 |
D |
14 |
1110 |
16 |
E |
15 |
1111 |
17 |
F |
Equivalent Table- Octal and |
|||
This number system table represents a relationship between Octal and Binary numbers. |
|||
Octal Number |
Binary Number |
||
0 |
000 |
||
1 |
001 |
||
2 |
010 |
||
3 |
011 |
||
4 |
100 |
||
5 |
101 |
||
6 |
110 |
||
7 |
111 |
||
Note: |
|||
1. 3 bits are required to represent Octal Number. |
|||
2. This table is useful when we convert number from binary to octal and octal to binary. |
Equivalent Table- Hexa-Decimal |
|||
This number system table represents a relationship between Hexa-Decimal and Binary numbers. |
|||
Octal Number |
Binary Number |
||
0 |
0000 |
||
1 |
0001 |
||
2 |
0010 |
||
3 |
0011 |
||
4 |
0100 |
||
5 |
0101 |
||
6 |
0110 |
||
7 |
0111 |
||
8 |
1000 |
||
9 |
1001 |
||
A |
1010 |
||
B |
1011 |
||
C |
1100 |
||
D |
1101 |
||
E |
1110 |
||
F |
1111 |
||
Note: |
|||
1. 4 bits are required to represent Hexa-Decimal Number. |
|||
2. This table is useful when we convert number from binary to Hexa-Decimal and Hexa-Decimal to binary. |
Number System Conversion
(a) CONVERTING DECIMAL TO ANOTHER BASE(2, 8, 16)
Decimal Number to Binary, Octal and Hexa-Decimal
(i) ( N)10 = ( )2
(ii) ( N )10 = ( )8
(iii) ( N)10 = ( )16
Here Decimal Number given in three format
(i) Integer e.g. (677)10
In this case, we use Division-Remainder Technique
|
Examples:
(ii) Fractional Part and e.g. (.725)10
In this case, we multiply the fractional part by Base (2, 8, 16).
This process is repeated till we get all zeros or repeat in the fractional part.
(iii) Mixed (Integer and Fractional) eg (77.34)10
(77.34)10 = ( )2
In this case, we convert into two steps-
(i) (77)10 = ( )2 and (ii) (.34)10 = ( )2
Step-I |
Step-II |
Therefore, (77.34)10 = (1001101.0101011 )2
(b) CONVERTING To DECIMAL From ANOTHER BASE(2, 8, 16)
(i) ( BN)2 = ( )10
(ii) ( ON )8 = ( )10
(iii) ( HN)16 = ( )10
In this case, we use
1. Determine the positional value of each digit.
2. Multiply the obtained positional value by the digits in the
corresponding position.
3. Sum the products.
Examples:
(1) (11101.101)2 = ( )10
4 3 2 1 0 -1 -2 -3 Positional Value
1 1 1 0 1 . 1 0 1
= 1×24 + 1×23 + 1×22 + 0x21 + 1×20 + 1×2-1 + 0x2-2+1×2-3
= 16 + 8 + 4 + 0 + 1 + ¼ + 0 + 1/8
= 29 + .25 + 0 + .125
= (29.375)10 Ans
(2) (1570.54)8 = ( )10
= 1×83 + 5×82 + 7×81 + 0x80 + 5×8-1 + 4×8-2
= 1×512+ 5×64 + 7×8 + 0x1 + 5x.125 + 4x.015625
= 512 + 320 + 56 + 0 + .625 + .0625
= (888.6875)10 Ans
(3) (D70.A1)16 = ( )10
= Dx162 + 7×161 + 0x160 + Ax16-1 + 1×16-2
= 13×256 + 7×16 + 0 + 10/16 + 1/256
= 3328 + 112 +.625 + .00390625
= (3440.62890625)10 Ans
(c) CONVERTING Numbers (When Not Given Decimal)
– Binary to Octal
– Octal to Binary
– Binary to Hexa-Decimal
– Hexa-Decimal to Binary
– Octal to Hexa
– Hexa to Octal
Rules:
1. To convert a binary number into octal number first of all we divide the binary digits of the given binary number into groups of three digits (starting from Right and in fractional part Start from Left)
2. Now convert each group of three binary digits to one octal digit using table.
Example:
(111011001)2 = ( )8
= 111 011 001 (Construct 3 digits pairs at right side)
Here 111 = 7 in octal
011 = 3
001 = 1
Ans: = (731)8
3. To convert an octal number into binary number, each digit of the octal number is replaced by its 3 digit equivalent binary number-using table.
Example:
(4016)8 = ( )2
Here 4 = 100 in (Equivalent Binary)
0 = 000
1 = 001
6 = 110
Ans: = (100 000 001 110)2
4. To convert a binary number into hexadecimal number first of all we divide the binary digits of the given binary number into groups of four digits (starting from Right and in fractional part Start from Left)
5. Now convert each group of four binary digits to one hexadecimal digit using table.
Example:
(111011001)2 = ( )16
= 0001 1101 1001 (Construct 4 digits pairs at right side)
Here 0001 = 1 in hexa-decimal
1101 = D
1001 = 9
Ans: = ( 1 D 9 )16
6. To convert hexadecimal number into binary number, each digit of the hexadecimal number is replaced by its 4 digit equivalent binary number-using table.
Example:
(401F.6B)16 = ( )2
Here 4 = 0100 in (Equivalent Binary)
0 = 0000
1 = 0001
F = 1111
6 = 0110
B = 1011
Ans: = (0100 0000 0001 1111.0110 1011)2
7. To convert an octal number to hexadecimal from, first we convert the given octal number to binary form.
8. After this, we convert this binary number to hexadecimal form.
9. To convert a hexadecimal number to octal from, first we convert the given hexadecimal number to binary form.
10. After this, we convert this binary number to octal form.