Number System and Data Representations
Number System and Data Representations
REPRESENTATIONS
ENCFAP1L – COMPUTER FUNDAMENTALS AND PROGRAMMING (LAB)
SECTION MEC211
TERM 1, AY 2021-2022
OVERVIEW
• Understanding number systems
• Decimal Numbers
• Binary Numbers
• Octal Numbers
• Hexadecimal Numbers
• The radix, or base, of a number system is the total number of unique symbols
available in that system.
• The largest valued symbol always has a magnitude of one less than the radix.
Radix or base
102
ENCFAP1L - MALAAY - 2021 9/4/2021 4
DECIMAL NUMBERS
• The digits are often used with a decimal separator which indicates the start of
a fractional part, and with one of the sign symbols plus (+) or minus (-) to
indicate signs.
ENCFAP1L - MALAAY - 2021 9/4/2021 5
DECIMAL NUMBERS
• The decimal system is a positional numeral system; it has positions for units,
tens, hundreds, etc.
• The position of each digit conveys the multiplier (a power of 10) to be used
with that digit – each position has a value ten times that of the position to its
right.
• The binary system works in exactly the same way, except that its place value
is based on the number 2.
• In the binary system, the places are named as: one’s place, two’s place, four’s
place, eight’s place, sixteen’s place, and so on.
ENCFAP1L - MALAAY - 2021 9/4/2021 7
BINARY NUMBERS
• Each place in the number represents two times the place to its right.
Radix or base
01012
ENCFAP1L - MALAAY - 2021 9/4/2021 8
BINARY NUMBERS
Decimal Binary • Example: digit 10, 1010
0 0000
1 0001
8 + 2 = 10
2 0010
3 0011
8 4 2 1
4 0100 1010
5 0101
6 0110 • Considering the digits that has a
7 0111 value of 1 and adding its number
8 1000 marker on the top of each digit.
9 1001
10 1010
• The octal number system has a radix or base of 8. Octal numbers are
composed of eight symbols: digits 0 to 7.
• Remember that binary numbers are based on the radix of 2 while decimal
numbers are based on the radix of 10.
• Remember also that binary numbers are only represented by 1s and 0s.
1. Place a number marker on top of the given digits, starting from 0 up to the
last given digits – starting from the right to determine the exponent to use.
2. Consider all 1s in the given digits and multiply it with the base number (2
for binary) and raise it to the exponent of the number which corresponds to
its number marker.
= (1*25)+(1*23)+(1*21)
1010102 = 4210
= (1*25)+(1*22)+(1*21)
1001102 = 3810
= (1*24)+(1*23)+(1*20)
0110012 = 2510
101.012 = ? 10
2 1 0 -1 -2
= 101.01
= (1*22)+(1*20)+(1*2-2)
101.012 = 5.2510
110.102 = ? 10
2 1 0 -1 -2
= 110.10
= (1*22)+(1*21)+(1*2-1)
110.102 = 6.5010
011.102 = ? 10
2 1 0 -1 -2
= 011.10
= (1*21)+(1*20)+(1*2-1)
011.102 = 3.5010
• Since 1 octal digit is equivalent to 3 binary digits, just group 3 binary digits
from the least significant bit (right side).
• Append 0 to the most significant bit (left side) if the grouping does not have
enough to form 3 binary digits. You must complete the 3-group digit.
• If you will be having a fraction (decimal point), append 0 to the least
significant bit (right side) of the given digits to complete the grouping of 3
bits.
ENCFAP1L - MALAAY - 2021 9/4/2021 21
BINARY TO OCTAL – STEPS
1. Group the given digits into 3 starting from the right side.
2. If the grouping is not complete, place 0 to complete the grouping.
3. Once you have grouped it into 3 digits, convert the binary digits into
decimal values following the concepts on converting binary to decimal. Start
converting from the right side.
1. Group the given digits into 4 starting from the right side.
2. If the grouping is not complete, place 0 to complete the grouping.
3. Once you have grouped it into 4 digits, convert the binary digits into
decimal values following the concepts on converting binary to decimal. Start
converting from the right side.
1. Divide the given decimal number with the base number you are converting it
to. In this case, by 2.
2. Whatever the answer you will get in the division will be divided again with
the base 2 until you cannot be divided anymore.
3. The remainder that you will get for each division will be considered as your
final converted answer.
1. Divide the given decimal number with the base number you are converting it
to. In this case, by 8.
2. Whatever the answer you will get in the division will be divided again with
the base 8 until you cannot be divided anymore.
3. The remainder that you will get for each division will be considered as your
final converted answer.
6610 = ?8 = 1028
remainder
= 66/8 2
remainder In reading, the
= 8/8 0 answer, you
remainder read it upward.
= 1/8 1
= 0/8 (cannot be!)
1. Divide the given decimal number with the base number you are converting it
to. In this case, by 16.
2. Whatever the answer you will get in the division will be divided again with
the base 16 until you cannot be divided anymore.
3. The remainder that you will get for each division will be considered as your
final converted answer.
1. Place a number marker on top of the given digits, starting from 0 up to the
last given digit – starting from the right to determine the exponent to use.
2. Consider all the given digits and multiply it with the base number (8 for
octal) and raise it to the exponent of the number which corresponds to its
number marker.
= (7*82)+(6*81)+(1*80)
7618 = 49710
= (7*82)+(6*81)+(1*80)+(1*8-1)+(5*8-2)
761.158 = 497.20312510
1. Convert each of the given octal number by simply using the concept of
4,2,1.
2. Place a binary 1 to correspond the given octal number.
7618 = ?2
convert 4 2 1
= 7 111
convert 4 2 1
= 6 110
convert 4 2 1
= 1 001
= 111 110 0012
4 2 1 4 2 1 4 2 1 4 2 1 4 2 1
= 1 1 1 1 1 0 0 0 1. 0 1 0 1 0 1
7 6 1 . 2 5
= 111 110 001.0101012
1. Convert each of the given octal number in binary by considering each given
digits and represent it in binary using the concept of 4,2,1.
2. Once it is binary, that’s the time you convert the binary to hexadecimal by
grouping it into 4.
4 2 1 4 2 1 4 2 1
= 111110001
7 6 1
= 0001 1111 0001 = 1F116
4 2 1 4 2 1 4 2 1 4 2 1 4 2 1
= 1 1 1 1 1 0 0 0 1. 1 1 1 1 0 1
7 6 1 . 7 5
= 0001 1111 0001.1111 0100
= 1F1.F416
7AE316 = ?2
convert 8 4 2 1
= 7 0111
convert 8 4 2 1
= A 1010
convert 8 4 2 1
= E 1110
convert 8 4 2 1
= 3 0011
= 0111 1010 1110 00112
7AE.316 = ?2
convert 8 4 2 1
= 7 0111
convert 8 4 2 1
= A 1010
convert 8 4 2 1
= E 1110
convert 8 4 2 1
= 3 0011
= 0111 1010 1110 . 00112
7AE316 = ?8
convert 8 4 2 1
= 7 0111
convert 8 4 2 1
= A 1010
convert 8 4 2 1
= E 1110
convert 8 4 2 1
= 3 0011
= 0111 1010 1110 00112
7AE.316 = ?8
convert 8 4 2 1
= 7 0111
convert 8 4 2 1
= A 1010
convert 8 4 2 1
= E 1110
convert 8 4 2 1
= 3 0011
= 0111 1010 1110 . 00112
1. Place a number marker on top of the given digits, starting from 0 up to the
last given digit – starting from the right to determine the exponent to use.
2. Consider all the given digits and multiply it with the base number (16 for
hexadecimal) and raise it to the exponent of the number which corresponds
to its number marker.
= (2*163)+(8*162)+(6*161)+(A*160)
286A16 = 1034610
= (2*162)+(8*161)+(6*160)+(A*16-1)
286.A16 = 646.62510