COMFUN 1200 Unit III

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 41

Introduction

To
Number Systems
ComFun1200 Lecture
Why use different number
systems?
 Different
number systems differ in the
manner they represent information
 Humans use letters and decimal numbers (0
- 9) to represent information
 Computers processes information using 1’s
and 0’s (binary)
 It
is necessary to know how information is
converted from one system to another
History of Number Systems
 Tally
 Babylonian
 Egyptian
 Mayan
 Roman
 Hindu-Arabic
Non-Positional vs. Positional
Number Systems
Non-Positional
 A symbol has the same value regardless of
its position in the representation
Positional
 Value of the digit is determined through:
 The digit itself
 The position of the digit in the number
 The base of the number system
Non-Positional vs. Positional
Number Systems (cont..)
Tally Number System

III
Decimal Number System

111
Understanding Positional
Number Systems
 Radix or Base
 Defines the number of symbols used in the
number system
 Base 10 (Decimal) – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
 Base 2 (Binary) – 0, 1

 Indicated by a subscript following the


number
 23410, 1112, 3A416
Understanding Positional
Number Systems (cont..)
 Power
 Determines how many times a digit will be
multiplied by itself based on its position
 A radix point divides the whole numbers
from fractional numbers
Understanding Positional
Number Systems (cont..)
 Most Significant Digit (MSD)
 The digit that has the greatest effect on the
value of the number
 Least Significant Digit (LSD)
 The digit that has the least effect on the
value of the number
Commonly Used Number
Systems in Computing
 Decimal (N10)
 Ten Symbols: { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
 Examples: 100110, 8810, 678.9310
 Binary (N2)
 Two Symbols: { 0, 1 }
 Examples: 10012, .0112, 1100.12
 Octal (N8)
 Eight Symbols: { 0, 1, 2, 3, 4, 5, 6, 7 }
 Examples: 77078, 34568, 1.768
 Hexadecimal (N16)
 Sixteen Symbols: { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }
 Examples: 218.AF16, FADE16, EBC.2616
Conversion Into Different Bases
 Non-Decimal Base to Decimal Base
 Decimal Base to Non-Decimal Base
 Non-Decimal to Another Non-Decimal
Base
Non-Decimal to Decimal
Rule:

To convert a number from a non-decimal


base system to its decimal system
equivalent, obtain the sum of the values of
the digits(in the given base)
N2 to N10
Example: Exercise:

101012 -> N10 11102-> N10


N8 to N10
Example: Exercise:

167.238 -> N10 21648 -> N10


N16 to N10
Example: Exercise:

E51316 -> N10 A31B16 -> N10


Decimal To Non-Decimal
Rule

To convert a decimal number to its non-


decimal base equivalent, we divide the
number by the base of the desired number
system. In the process, we take note of the
quotient and remainder. We perform a
successive division to every quotient until we
get a zero, while we take note of the remainder
in each process.
N10 to N2
Example: 19510 -> N2
N10 to N8
Example: 11910 -> N8
N10 to N?
Exercises:

1. 43210 -> N2
2. 69810 -> N8
3. 103410 -> N16
Other Conversions
N2 <-> N8
Example: 11101011012 -> N8
Other Conversions (cont..)
N2 <-> N16
Example: 11011011102 -> N16
Other Conversions (cont..)
Exercises:

1. 72348 -> N2
2. 3CF516 -> N2
3. 110111012 -> N8
4. 10001011102 -> N16
Non-Decimal to Another Non-
Decimal Base
Rule: For other cases of number system
conversions not stated in the earlier
methods, use the decimal or binary
representation as an intermediate form.
N8 to N10
Example: 5678 -> N10
N8 to N10
Exercise: 6248 -> N10
N16 to N8
Example: 1A216 -> N8
N16 to N8
Exercise: B6F16 -> N8
Assignment
1. 1001112 -> N10
2. 51778 -> N10
3. BA02C16 -> N10
4. 31710 -> N2
5. 613810 -> N8
6. 854010 -> N16
7. 1110110112 -> N8
8. 10110111011102 -> N16
9. 76228 -> N16
10. E87AF16 -> N8
Addition in Different Number
Systems
Rule:

Addition of numbers (in any base) follows a


common rule. We just take note of the base of
the numbers being added. We take for
example the addition of decimal numbers
(base 10) 563 and 347. Observe that if the sum
of the digits is greater than or equal to the base
of the numbers, we subtract the base from the
sum and a carry is produced.
Addition in Different Number
Systems (cont..)
Example: 56310 + 34710
Addition in Different Number
Systems (cont..)
Example: 1102 + 1112
Addition in Different Number
Systems (cont..)
Example: 778 + 478 + 68 + 128
Addition in Different Number
Systems (cont..)
Exercises:

1. 110112 + 11002
2. 10012 + 11002 + 1112
3. 41678 + 20238
4. 6218 + 2148 + 558
5. 3AB116 + ACF016
6. 41A16 + D0416 + B616
Subraction in Different Number
Systems
Rule:

The base of the number system is important


in subtraction. When we borrow, we
subtract 1 from the preceeding digit but we
add the value of the base to the borrowing
digit.
Subraction in Different Number
Systems (cont..)
Example: 50710 - 8910
Subraction in Different Number
Systems (cont..)
Example: 11002 - 1112
Subraction in Different Number
Systems (cont..)
Example: 3F1216 - 3DB16
Subraction in Different Number
Systems (cont..)
Exercises:

1. 1010012 – 101112
2. 41538 – 26778
3. C87A16 – 9B6E16
2’s Complement Notation
 Used for signed(+/-) number operations
 Negative numbers are represented using the
2’s complement method in computing
 Subtractions can be performed as additions
making subtraction circuits unnecessary
 2’s complement is characterized by:
 A fixed number of bits to represent numbers.
 The most significant bit is called the sign bit(0 for
positive and 1 for negative).
2’s Complement Notation
(cont..)
2’s Complement Notation
(cont..)
Addition using the
2’s Complement Notation

You might also like