ICT 7 SSC SLK Q2 - Week1
ICT 7 SSC SLK Q2 - Week1
KAGAWARAN NG EDUKASYON
Rehiyon I
Sangay ng Ilocos Sur
LESSON TITLE:
NUMBER SYSTEMS
Quarter 2- Week: 1
2
At the end of the lesson, you are expected to:
Identify the different Number Systems,
Manipulate particular set of data,
Represent data in many different forms,
Calculate each numerical data format in
different methods of arithmetic calculations, and
Perform format conversions between data
format.
3
might be chosen for convenience, efficiency, technological, or any other
reasons. Historically, it seems that the main reason we use base 10 is that
humans have ten fingers, which is as good a reason as any. Any number
can be represented equivalently in any base, and it is always possible to
convert a number from one base to another without changing its meaning
or actual value, although its appearance will be different.
Computers perform all of their operations using the binary, or base
2, number system. All program code and data are stored and manipulated
in binary form. Calculations are performed using binary arithmetic. Each
digit in a binary number is known as a bit (for binary digit) and can have
only one of two values, 0 or 1. Bits are commonly stored and manipulated
in groups of 8 (known as a byte), 16 (usually known as a halfword), 32 (a
word), or 64 bits (a doubleword). Sometimes other groupings are used.
The number of bits used in calculations affects the accuracy and
size limitations of numbers manipulated by the computer. The number of
bits used can actually be specified by the programmer in declaration
statements. In the programming language Java, for example, the
programmer can declare a signed integer variable to be short (16 bits), int
(32 bits), or long (64 bits) depending on the anticipated size of the number
being used and the required accuracy in calculations. The knowledge of
the size limits for calculations in a particular language is sometimes
extremely important, since some calculations can cause a numerical
result that falls outside the range provided for the number of bits used. In
some cases this will produce erroneous results, without warning to the
end user of the program.
It is useful to understand how the binary number system is used
within the computer. Often, it is necessary to read numbers in the
computer in their binary or equivalent hexadecimal form. For example,
colors in Visual Basic, Java, and many other languages can be specified
as a six-digit hexadecimal number, which represents a 24-bit binary
number. This lesson looks informally at number systems in general and
explores the relationship between our commonplace decimal number
system and number systems of other bases. Our emphasis, of course, is
upon base 2, the binary number system. The discussion is kept more
general, however, since it is also possible, and in fact common, to
represent computer numbers in base 8 (octal) or base 16 (hexadecimal).
Occasionally, we even consider numbers in other bases, just for fun, and
also, perhaps, to emphasize the idea that these techniques are completely
general.
4
we have exhausted all possible single digits in the decimal number
system; to proceed further, we extend the numbers to the 10’s place: 10,
11, 12, 13, 14, and so on. It is productive to consider what “the 10’s place”
really means. The 10’s place simply represents a count of the number of
times that we have cycled through the entire group of 10 possible digits.
Thus, continuing to count, we have
1 group of 10 + 0 more
1 group of 10 + 1 more
1 group of 10 + 2
.
.
.
1 group of 10 + 9
2 groups of 10 + 0
.
.
.
9 groups of 10 + 9
At this point, we have used all combinations of two digits, and we
need to move left another digit. Before we do so, however, we should note
that each group shown here represents a count of 10, since there are 10
digits in the group. Thus, the number 43 really refers to
4 × 10 + 3
As we move leftward to the next digit, that is, the hundreds place,
we are now counting cycles of the rightmost two digits or, in other words,
groups of 10 × 10, or 102, or hundreds. Thus, the number 527 really
represents
five groups of (10 × 10) + two groups of 10 + 7
5
digit. For example, the weights of the digits in base 8, reading from right
to left are 1, 8, 64, 512, . . . , or, if you prefer, 8 0, 81, 82, 83, . . . . Just as
you would expect, the weight of a digit in any base n is n times as large
as the digit to its right and (1/n)th as large as the digit to its left. Table 1
shows the corresponding method of counting in base 2. Note that each
digit has twice the weight of its next rightmost neighbor, just as in base 10
each digit had ten times the weight of its right neighbor. This is what you
would expect if you consider that there are only two different values for
digits in the binary cycle. You should spend enough time studying this
table until you understand every detail thoroughly.
TABLE 1.
Counting in Base 2
NUMBER EQUIVALENT OCTAL DECIMAL HEXA-
EQUIVALENT EQUIVALENT DECIMAL
(Base 8) (Base 10) EQUIVALENT
(Base 16)
0 0 × 20 0 0 0
1 1 × 20 1 1 1
10 1 × 21 + 0 × 20 2 2 2
11 1 × 21 + 1 × 20 3 3 3
100 1 X 22 + 0 + 0 4 4 4
101 1 × 22 + 0 × 20 5 5 5
110 1 × 22 + 1 × 21 6 6 6
111 1 × 22 + 1 × 7 7 7
21+ 1 × 20
1000 1 × 23 + 0 + 0 8 8
+0
1001 1 × 23 + 0 + 0 9 9
+ 1 × 20
1010 1 × 23 + 0 + 1 A (10)
× 21 + 0
1011 1 × 23 + 0 + 1 B (11)
× 21 + 1 x 2 0
1100 1 × 23 + 1 × 22 C (12)
+0+0
1101 1 × 23 + 1 × 22 D (13)
+ 0 + 1 x 20
1110 1 × 23 + 1 × 22 E (14)
+ 1 x 21 + 0
1111 1 × 23 + 1 × 22 F (15)
+ 1x 21 + 1 x
20
6
As an example,
1100101002 =
1 × 2 + 1 × 2 + 0 × 2 + 0 × 25 + 1 × 24 + 0 × 23 + 1 × 22+ 0 × 21 + 0 x 20
8 7 6
=
256 + 128 + 16 + 4 = 40410
You should probably work out this example and check your results.
Binary Numbers
A number system which has a base of 2 and has values 1 and 0.
These values has an equivalent of True (1) or False (0) or Yes (1) or No
(0). Examples are 102, 112, 1012, and so on.
Binary Addition
0+0= 0
0+1= 1
1+0= 1
1+1= 0 with a carry-over of 1
Example:
Binary Subtraction
0-0= 0
0-1= 1 with a borrow of 1
1-0= 1
1+1= 0
Example:
7
Numeric Conversion between Number Bases
A. Binary (base 2) to Decimal (base 10)
Conversion of binary to decimal (base-2 to base-10) numbers and
back is an important concept to understand as the binary numbering
system forms the basis for all computer and digital systems.
Table 1.
MSB Binary digit LSB
2n 28 27
2 6
25 24 23
2 2 1
2 20
N 256 128 64 32 16 8 4 2 1
MSB LSB
100012
In the binary number system, the weight of each digit increases by
a factor of 2 as shown (Table 1). Then the first digit has a weight of 1 ( 20 ),
the second digit has a weight of 2 ( 21 ), the third a weight of 4 ( 22 ), the
fourth a weight of 8 ( 23 ) and so on.
Example:
Convert, 100012 = ____________ 10
Solution;
1 X 20 = 1
0 X 21 = 0
0 X 22 = 0
0 X 23 = 0
1 X 24 = 16
Table 2.
Decimal digit value
16 8 4 2 1
Binary digit value
1 0 0 0 1
8
B. Decimal (base 10) to Binary (base 2)
The decimal or “denary” counting system uses the Base-of-10
numbering system where each digit in a number takes on one of ten
possible values, called “digits”, from 0 to 9, eg. 21310 (Two Hundred and
Thirteen).
Solution;
65 / 2 = 32 r. 1
32 / 2 = 16 r. 0
16 / 2 = 8 r. 0
8 / 2 = 4 r. 0 Step 5.
4 / 2 = 2 r. 0
2 / 2 = 1 r. 0
1 / 2 = 0 r. 1
Table 3.
Binary number Octal number
000 0
001 1
010 2
011 3
100 4
101 5
9
110 6
111 7
Example:
Solution;
1 = 1, 001 = 1, 101 = 5
Copy 1, 1 and 5. Final answer is 1158.
Example:
Convert Octal number 205 into binary number.
Solution:
First convert it into decimal or hexadecimal number,
= 2058
= (2x82+0x81+5x80)8 or (010 000 101)2
For simpler method (direct method), use the Table 3 for your reference.
10
E. Binary (base 2) to Hexadecimal (base 16)
To do this, group the given binary number into group of 4 starting
from the rightmost part (LSB) and get the hexa-decimal equivalent from
Table 4. Copy the equivalent number on each group starting from MSB to
get the final octal answer.
Table 4.
Binary number Hexa-Decimal number
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A (10)
1011 B (11)
1100 C (12)
1101 D (13)
1110 E (14)
1111 F (15)
Example:
Solution;
100 = 4, 1101 = D
Copy 4 and D. Final answer is 4D8.
11
However, there is a potential problem with using this method of digit
notation caused by the fact that the decimal numerals of 10, 11, 12, 13,
14 and 15 are normally written using two adjacent symbols. For example,
if we write 10 in hexadecimal, do we mean the decimal number ten, or the
binary number of two (1 + 0). To get around this tricky problem
hexadecimal numbers that identify the values of ten, eleven, . . . , fifteen
are replaced with capital letters of A, B, C, D, E and F respectively.
Example:
Step 1: Separate the digits of the given octal number, if it contains more
than 1 digit.
Step 2: Multiply each digit of octal number with its increasing power of 8
from right to left.
Step 3: Add all the individual results provides the equivalent decimal
number.
Example:
Solution:
= 1 4 3
= 1 X 82 + 4 X 81 + 3 X 80
= 64 + 32 + 3
= 99910
Example:
Solution:
= 143 / 8 = 17 r. 7
= 17 / 8 =2 r. 1
=2/8 =0 r. 2
Step 1: Separate the digits of the given octal number, if it contains more
than 1 digit.
Step 2: Find the equivalent binary number for each digit of octal
number. Add 0's to the left if any of the binary equivalent is shorter than
3 bits.
Step 3: Write the all groups binary numbers together, maintaining the
same group order.
Step 4: Separate the binary digits into groups, each containing 4 bits or
digits from right to left. Add 0s to the left, if the last group contains less
than 4 bits.
Step 5: Find the hex equivalent for each group.
Step 6: Write all hex equivalent of each digit together where keeping the
same order provides the hexadecimal equivalent for the given octal
number.
13
Example:
Solution:
= 7 5 2
= 111 101 010
= 111101010
= 1 1110 1010
= 1 E A
Step 1: Separate the digits of the given hex number, if it contains more
than 1 digit.
Step 2: Find the equivalent binary number for each digit of octal number.
Add 0's to the left if any of the binary equivalent is shorter than 4 bits.
Step 3: Write the all groups binary numbers together, maintaining the
same group.
Step 4: Separate the binary digits into groups, each containing 3 bits or
digits from right to left. Add 0s to the left, if the last group contains less
than 3 bits.
Step 5: Find the octal equivalent for each group.
Step 6: Write all octal equivalent of each digit together where keeping
the same order provides the octal equivalent for the given hexadecimal.
Example:
Solution:
= B 5 A
= 1011 0101 1010
= 101101011010
= 101 101 011 010
= 5 5 3 2
14
J. Hexa-Decimal (base 16) to Decimal (base 10)
Example:
Solution:
= 3 11 (B)
= 3 X 161 11 X 160
= 48 + 11
= 5910
GENERALIZATION
16
ASSESSMENT
_____ 8. This number system uses F as equivalent for the number 15.
A. Binary B. Decimal C. Octal D. Hexa-decimal
II. Direction: Answer the following. Show your solutions in your answer
sheets.
A.
1.) 111 + 100 = 3.) 1111 + 111 =
2.) 101 + 110 = 4.) 11 + 1 =
17
5.) 11 – 10 = 7.) 110 – 10 =
6.) 1111 – 110 = 8.) 100 – 11 =
REFERENCES
Well Done!
Congratulations! You did a great
job! Rest and relax while you wait
for the next lesson. Good luck!
18
ANSWER KEYS
Exercise 1: Assessment
1. 110000 I.
2. 100000 1. A
3. 101110 2. D
4. 1001100 3. B
5. 1001001 4. B
6. 10 5. A
7. 11 6. C
8. 111 7. B
9. 100100012 8. D
10. 11100002 9. D
10. B
II. A.
1.1011
2.1011
3.10110
4.100
5.1
6.1001
7.100
8.1
B.
9. 3116
10. 4CC16
11. A16
12. 1258
13. 8510
14. 201410
19