MOD 2 - Data Representation and Number System
MOD 2 - Data Representation and Number System
FUNDAMENTALS OF
INFORMATION
TECHNOLOGY
Decimal
representation 10000 1000 100 10 1
Base 2
representation 27 26 25 24 23 22 21 20
Decimal
representation 128 64 32 16 8 4 2 1
Base 2
representation 1 0 0 1 0 0 0 1
Converting Decimal
• Convert decimal 35 to binary
to Binary
1.Using 8 bits, find largest power of 2 that will “fit” into 35
2.Place a 1 into that slot
3.If the # doesn’t fit, place a 0 into that slot
Power of 2
representation 27 26 25 24 23 22 21 20
Decimal 128 64 32 16 8 4 2 1
representation
Base 2
representation 0 0 1 0 0 0 1 1
35 = 00100011
Convert Binary to Decimal
1.Choose an 8 bit binary number = 10101110
2.Write the binary digits under the correct column
3.For each column with a 1, you will add that decimal value
4.You will not add the values of the columns you entered 0
Power of 2
representation 27 26 25 24 23 22 21 20
Decimal
representation 128 64 32 16 8 4 2 1
Base 2
1 0 1 0 1 1 1 0
representation
Step 4. Step 3.
After processing, the binary The signal for the capital letter D
code for the capital letter D is is converted to its ASCII binary
converted to an image, and code (01000100) and is stored in
displayed on the output device. memory for processing.
Memory
• What is memory?
Seat #2B4 Seat #2B3
16
16
Conversion between Number
Systems
Decimal real number into Binary, Octal and Hexadecimal
1.Indirect Method:
Binary Decimal Octal
e.g. (11011)2
Its decimal equivalent is
1x24+1x23+0x22+1x21+1x20 = (27)10
And its Octal equivalent is (33)8 (division method)
Conversion between Number
Systems
Binary to Octal (Contd…)
2. Direct Method
Binary Octal
Step 1: Make the group of 3-bits from right to left for integer from left to
right for fraction.
Step 2: Find decimal equivalent of each group.
Note: if the left most group (in integer) and the right most group (in
fraction) present with less than 3-bits make that group by adding one or
two zeros.
Conversion between Number
Systems
Binary to Octal (Contd…)
1.Indirect Method:
Binary Decimal Hexa
e.g. (11011)2
Its decimal equivalent is
1x24+1x23+0x22+1x21+1x20 = (27)10
And its Hexa equivalent is (1B)16 (Division method)
Conversion between Number
Systems
Binary to Hexa
2. Direct Method:
Binary Hexa
Step 1: Make the group of 4-bits from right to left for integer from left to
right for fraction.
Step 2: Find decimal equivalent of each group.
Note: if the left most group (in integer) and the right most group (in
fraction) present with less than 4-bits make that group by adding one, two
or three zeros.
Conversion between Number
Systems
Binary to Hexa
There are three ways for representing the positive and negative
integers into its binary equivalent.
1.Sign magnitude representation
2.One’s Complement
3.Two’s Complement
Binary representation of integers
0+0=0
0+1=1
1+0=1
1 + 1 = 0 (Carry 1)
Binary Addition
Example:
1 1 0 1 0 1
1 0 1 1 1 1
1 1 0 0 1 0 0
Binary Addition
Example:
1 0 1 1 0
0 1 1 0 1
1 0 0 0 1 1
***END***