Data Representation Lesson Plan
Data Representation Lesson Plan
Number systems are systems or styles of notations that represent quantities or numbers. These include:
In the decimal system, the value to the left of a number is alays ten times greater. Decimal, meaning a
number expressed in scale of tens.
nits 100 1
Tens 101 10
Hundreds 102 100
Thousands 103 1000
p
å are simply an extension of the principals of the place value in each direction. If the
place value of the numbers increase as e move to the left on the decimal point, the place value
becomes smaller, on the other hand, if e move to the right.
1/10 10ë1 .1
1/100 10ë2 .01
1/1000 10ë3 .001
DATA REPRESENTATION
cLESSON 5 ETHEL V. FAJARDO
The value of the number 5.367 is expressed as follos
The process is basically a series of repeated division by the number of the base to hich you ish to
convert. To things to keep in mind:
EXAMPLE:
36 = 0100100
&
2 36 0
2 18 0
2 9 1
2 4 0
2 2 0
2 1 1
2 0 0
DATA REPRESENTATION
LESSON 5 ETHEL V. FAJARDO
93=01011101
&
2 93 1
2 46 0
2 23 1
2 11 1
2 5 1
2 2 0
2 1 1
2 0 0
p '
( &
EXAMPLE:
DATA REPRESENTATION
£LESSON 5 ETHEL V. FAJARDO
p &
'
(
'
( &
.1 2ë1 ½ = .5
.01 2ë2 1/1 = .25
ë3
.001 2 1/8 = .125
.0001 2ë4 1/16 = .0625
.00001 2ë5 1/32 = .03125
.000001 2ë6 1/64 = .015625
ë7
.0000001 2 1/128 = .0078125
.00000001 2ë8 1/256 = .00390625
ë9
.000000001 2 1/512 = .001953125
.0000000001 2ë10 1/1024 = .0009765625
Decimal fraction may be converted to binary by repeatedly multiplying the fraction by 2, the base to
hich e are converting. Multiplication continues until the products become 9 or until e have as many
digits of precision as e require.
EXAMPLE:
0.6875 = 1011
&' &
-
0.6875 2 1 0.375
0.375 2 0 0.75
0.75 2 1 0.5
0.5 2 1
0.358 = 010110
&' &
-
0.358 2 0 0.716
0.716 2 1 0.432
0.432 2 0 0.864
0.864 2 1 0.728
0.728 2 1 0.456
0.456 2 0 )%.c
0.912 2 1 0.824
0.824 2 1 0.648
0.648 2 1 0.296
0.296 2 0 0.592
DATA REPRESENTATION
LESSON 5 ETHEL V. FAJARDO
p '
(
The folloing are the four basic rules in addition of binary numbers:
p 0+0=0
p 0+1=1
p 1+0=1
p 1 + 1 = 0 (Plus a carryëover of 1)
EXAMPLE:
=0+8+0+2+1
= 11
p '
( '
The folloing are the four basic rules in subtractions of binary numbers:
p 0å0=0
p 1å0=1
p 1å1=0
p 0 å 1 = 0 (With a borro of 1)
DATA REPRESENTATION
LESSON 5
ETHEL V. FAJARDO
EXAMPLE:
=8+0+0+0
=ë8
101 101 = 1X2 + 0X21 + 1X20
2
5
ë 111 =4+0+1 ë7
010 =5 ë2
ë 111 = 1X2 + 1X21 + 1X20
2
=4+2+1
= ë7
p '
(&
The binary multiplication table is:
p 0X0=0
p 1X0=0
p 0X1=0
p 1X1=1
EXAMPLE:
p '
(
In the binary division, e ill try to subtract the divisor from each excessive group of digits in the
dividend as e ork from left to right.
The complete table for binary division is:
p 0/1 = 0
p 1/1 = 1
DATA REPRESENTATION
ÑLESSON 5 ETHEL V. FAJARDO
When doing binary division, e need to remember some important rules:
1.p When the remainder is greater than or equal to the divisor, rite a 1 in the quotient and
subtract.
2.p When the remainder is less than the divisor, rite a 0 in the quotient and add another digit
from the dividend.
3.p If all the digits of the dividend have been considered and there is still a remainder, mark a
radix point in the dividend and append a zero. Remember that some fractions do not have an
exact representation in binary, so not all division problems ill terminate.
EXAMPLE 1:
DATA REPRESENTATION
èLESSON 5 ETHEL V. FAJARDO
7.p Note that e still have a remainder after ppppp pp
considering all the digits of the dividend. This p p
means our anser ill include a fraction. To pppppp p
finish our problem e need to mark the radix ppppppp p
point and append a zero to the dividend. pppppppp p
cc
8.pNo e bring don the extra zero and p
compare the remainder ith our divisor. pppppppp p
Notice e ignore the radix point in our p p
comparison. 1102 equals 1102 so e rite pppppp p
ppppppp p
another 1 in the quotient and subtract. This
pppppppp p
completes our division because e have no
ppppppppp p
more digits in the dividend and no ppppppppp p
remainder. pppppppppppp
EXAMPLE 2:
101 / 1111 = 11 ___11
101 | 1111
101
101
101
000
DATA REPRESENTATION
ÿLESSON 5 ETHEL V. FAJARDO
EXAMPLE:
DIVISIONS REMAINDERS
Given 18
18/8 = 2 2
2/8 = 0 2
Therefore: 1810 = 228
Given 255
255/8 = 31 7
31/8 = 3 7
3/8 = 0 3
Therefore: 25510 = 3778
Given 3965
3965/8 = 495 5
495/8 = 61 7
61/8 = 7 5
7/8 = 0 7
Therefore 396510 = 75758
p 0 &
In the octal number system each digit corresponds to a poer of 8. To convert from octal to decimal,
multiply each octal digit by its position value and add the resulting products.
- &
123ÿ
810 1073741824
89 134217728
88 16777216
87 2097152
86 262144
85 32768
84 4096
83 512
82 64
81 8
80 1
8ë1 1/8 = 0.125
8ë2 1/64 = 0.015625
8ë3 1/512 = 0.001953125
8ë4 1/4096 = 0.000244140625
8ë5 1/32768 = 0.00003051757813
8ë6 1/262144 = 0.000003814697265625
EXAMPLE:
p
When converting decimal fractions to octal fractions multiply the decimal number by eight and note the
carry into the integer position.
EXAMPLE:
p 0'
(
BINARY N MBER 000 001 010 011 100 101 110 111
OCTAL N MBER 0 1 2 3 4 5 6 7
EXAMPLE:
DATA REPRESENTATION
c)LESSON 5 ETHEL V. FAJARDO
p '
(0
Converting from binary to octal is the reverse of the procedure. It is important to group the bits in threes,
starting at the binary point, orking both ays, and then converting each group of three to its octal
equivalent. Zeroes are added to each and to make a complete group.
p
p 24"
/It is a Base 16 numbering systemp
pThere are 16 numeric symbols, 0 1 2 3 4 5 6 7 8 9 A B C D E F
5
1.p Divide the decimal number by 16. Treat the division as an integer division.
2.p Write don the remainder (in hexadecimal).
3.p Divide the result again by 16. Treat the division as an integer division.
4.p Repeat step 2 and 3 until result is 0.
5.p The hex value is the digit sequence of the remainders from the last to first.
5 a remainder in this topic refers to the left over value after performing an integer division.
DATA REPRESENTATION
ccLESSON 5 ETHEL V. FAJARDO
4c
Convert the number ccÿ DECIMAL to HEXADECIMAL
&
32+ &
Start by dividing the number by 16.
Side note: You can get the remainder of a division using the &" or 6 operator. Ie: 1128%16=8.
4
Convert the number Ñ DECIMAL to HEXADECIMAL
&
32+
256 / 16 16 0
16 / 16 1 0
1 / 16 0 1
ANSWER 100
DATA REPRESENTATION
cLESSON 5 ETHEL V. FAJARDO
4£
Convert the number .c DECIMAL to HEXADECIMAL
&
32+
921 / 16 57 9
57 / 16 3 9
3 / 16 0 3
ANSWER 399
4
Convert the number cÿÿ DECIMAL to HEXADECIMAL
&
32+
188 / 16 11 C (12 decimal)
11 / 16 0 B (11 decimal)
ANSWER BC
Note that here; the anser ould not be 1112, but BC. Remember to rite don the remainder in hex, not decimal.
4
Convert the number .) DECIMAL to HEXADECIMAL
&
32+
590 / 16 36 E (14 decimal)
36 / 16 2 4 (4 decimal)
2 / 16 0 2 (2 decimal)
ANSWER 24E
1.p Get the last digit of the hex number; call this digit the
.
2.p Make a variable, let's call it #. Set the value to 0.
3.p Multiply the
"
ith (16^#), store the result.
4.p Increment # by 1.
5.p Set the
to the previous digit of the hex number%
6.p Repeat from step 3 until all digits have been multiplied.
7.p Sum the result of step 3 to get the anser number.
DATA REPRESENTATION
c£LESSON 5 ETHEL V. FAJARDO
4c
Convert the number ccÿ HEXADECIMAL to DECIMAL
&
Start from the last digit of the number. In this case, the number is 112ÿ.
8 x (16^0) 8 The last digit of that number is ÿ. Note that the poer of 0 of any
number is alays 1
Process the previous, hich is . Multiply that number ith an increasing
2 x (16^1) 32
poer of 16.
1 x (16^2) 256 Process the previous digit, hich is c, note that 16^2 means 16 x 16
1 x (16^3) 4096 Process the previous digit, hich is c, note that 16^3 means 16 x 16 x 16
Here, e stop because there's no more digit to process
This number comes from the of the RES LTS
ANSWER 4392
(8+32+256+4096)=4392
Once discerned, notice that the above process is essentially performing this calculation:
p Counting the number of digits takes extra time, and you might count rongly.
p If you don't remember hat a particular value of a poerëofë16 is, it's easier to calculate it from the previous
poer value. For instance, if you don't remember hat the value of 16^3 is, then just multiply the value of
16^2 (hich you'll likely already have if you started backard) ith 16.
4
Convert the number ÿ. HEXADECIMAL to DECIMAL
&
9 x (16^0) 9
8 x (16^1) 128
5 x (16^2) 1280
ANSWER 1417
If you ant to be a speed counter, it's beneficial to memorize the values of the smaller poer of 16s, such as in this table
DATA REPRESENTATION
cLESSON 5 ETHEL V. FAJARDO
4£
Convert the number c £c HEXADECIMAL to DECIMAL
(This time, let's use the table of the poerëofë16s above.)
&
1x1 1
3 x 16 48
5 x 256 1280
1 x 4096 4096
ANSWER 5425
4
Convert the number ÿ HEXADECIMAL to HEXADECIMAL
&
8x1 8
A x 16 (remember that hex A=decimal 10) 160
F x 256 (remember that hex F=decimal 15) 3840
ANSWER 4008
4
Convert the number ÿ HEXADECIMAL to DECIMAL
&
Fx1 15
8 x 16 128
ANSWER 143
4Ñ
Convert the number £ £ HEXADECIMAL to DECIMAL
DATA REPRESENTATION
c LESSON 5
ETHEL V. FAJARDO
p 2+ &0'
(
Converting hex number to binary number is very easy, it's almost trivial. The only requirement is that
you kno the equivalent binary value of each hexadecimal "digit" (0 to F); or if not, you must kno ho
to convert them by hand. Belo is a table that shos each hexadecimal digit ith its corresponding
binary number.
Note that every binary number on this table consists of four digits. This is necessary because the
maximum hexadecimal digit value is F or 15, hich translates to fourëdigitsëbinary 1111.
HEX BINARY
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
(Technically, any trailing 0 at the beginning of a number doesn't mean anything. So, binary 0010 is the same as
binary 10, but for conversion purpose, include the trailing 0s.)
To convert a hexadecimal number to binary. Just rite don the binary value of each hex digit.
4c5
To convert hexadecimal F8 to binary, rite don the binary for F first, then the binary for 8.
F 8
1111 1000
So, the anser is 11111000.
This seems too easy, and it is. se a calculator to convince yourself.
DATA REPRESENTATION
cÑLESSON 5 ETHEL V. FAJARDO
45
Convert hex number 1A to binary.
1 A
0001 1010
So, the anser is 00011010. (Note: Once you got the anser, you can ignore the zeros at the beginning, so this can
be also ritten as 11010.)
&45
hex D C C
bin 1101 1100 1100
hex 1 0 0 3
bin 0001 0000 0000 0011
hex F 3 A 2
bin 1111 0011 1010 0010
This time, let's assume e have a binary number that needs to be converted to hex. For example, the binary number
11010. In this case because the number of digits is not a multiple of 4, insert 0s at the beginning to make the number
multiple of four. So it becomes 00011010. We then separate each fourëdigit pair and get their corresponding hex
values.
0001 1010
1 A
So, the anser is 1A.
Realize that this is the only ay the number 4 in binary can be represented.
DATA REPRESENTATION
cèLESSON 5 ETHEL V. FAJARDO
A Number = (b1)*(2^3) + (b2)*(2^2) + (b3)*(2^1) + (b4)*(2^0)
or
A Number = (b1)*8 + (b2)*4 + (b3)*2 + (b4)*1
here b1, b2, b3, b4 must be either 1 or 0.
So, let's say e're looking for the binary of 9. What sequence of bs ill sum to 9? There's alays one unique anser:
Ho about the binary of 7. What sequence of bs ill sum to 7? Again, there's only one anser:
I've added a decimal column to the table; it's shon belo. See Converting Binary.
HEX DECIMAL BINARY
0 0 = 0+0+0+0 0000
1 1 = 0+0+0+1 0001
2 2 = 0+0+2+0 0010
3 3 = 0+0+2+1 0011
4 4 = 0+2+0+0 0100
5 5 = 0+4+0+1 0101
6 6 = 0+4+2+0 0110
7 7 = 0+4+2+1 0111
8 8 = 8+0+0+0 1000
9 9 = 8+0+0+1 1001
A 10 = 8+0+2+0 1010
B 11 = 8+0+0+1 1011
C 12 = 8+4+0+0 1100
D 13 = 8+4+0+1 1101
E 14 = 8+4+2+0 1110
F 15 = 8+4+2+1 1111
DATA REPRESENTATION
cÿLESSON 5 ETHEL V. FAJARDO