Number Systems

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 25

Computing Fundamentals

Number Systems
Join the Group
o [email protected]

o For course outline, lecture plan, assignments and


(possibly) announcements.
Positional vs. Non-Positional Number
Systems
o Non-Positional Number Systems
 Symbols used to represent quantities/values
 E.g.
• Roman numbers system
• Egyptian number system

o Difficult for arithmetic


operations
Positional vs. Non-Positional Number
Systems
o Positional Number Systems

 Decimal

 Binary
 Octal
 Hexadecimal
Decimal

5
Binary

6
Binary
o Binary TO Decimal Conversion

7
Binary
o Decimal TO Binary Conversion

8
Octal
o Octal to Decimal Conversion
o Decimal to Octal Conversion
o Octal to Binary Conversion
o Binary to Octal Conversion

9
Hexadecimal
o Hex to Decimal Conversion
o Decimal to Hex Conversion
o Hex to Binary Conversion
o Binary to Hex Conversion

10
FRACTIONS

11
Conversion of Decimal fraction to
Binary
Example:
Integer Fraction
0.6875 x 2 = 1.3750 = 1 + 0.3750

x 2 = 0.7500 = 0 + 0.7500

x 2 = 1. 5000 = 1 + 0.5000

x 2 = 1. 0000 = 1 + 0.0000

0.6875 = (0.1 0 1 1) 2

13
Conversion of Decimal fraction to
Binary (cont.)
o To convert a full Decimal Number to Binary, Convert the
integer and Fraction Part Separately:
o Example
 Convert 3.6875 to Binary
 Step-1
• Convert Integer Part to Binary:
• 3 = (11)2
 Step-2
• Convert Fraction Part to Binary:
• 0.6875 = (0.1011)2
 Step-3
• Combine them:
• 3.6875 = (11.1011)2

14
Conversion of Binary Fraction to
Decimal fraction
Example:
(0 .10 1 1) 2 = __1 + __
0 + __ 1 + __1
( 2)1 (2 )2 ( 2)3 ( 2)4

= 0.5 + 0 + 0.125 + 0.0625


= 0.6875

15
Conversion of Binary fraction to
Decimal (cont.)
o To convert a full Binary Number to Decimal, Convert the
integer and Fraction Part Separately:
o Example
 Convert (11.1011)2 to Decimal
 Step-1
• Convert Integer Part to Decimal:
• (11)2 = 3
 Step-2
• Convert Fraction Part to Decimal:
• (0.1011)2 = 0.6875
 Step-3
• Combine them:
• (11.1011)2 = 3.6875

16
Homework
o Conversion of HEX fractions into Decimal and vice
versa

o Conversion of Octal fractions into Decimal and


vice versa

 Show three examples each

17
COMPLEMENTS

18
Complements
o Used to simplify subtraction operation in digital
computers
o Simplifying operation  simple circuit

o Two Types
 Radix Complement (r’s complement)
 Diminished Radix Complement ((r-1)’s complement)
 Where r = base of the number M

19
Diminished Radix Complement
o Given a number N in base r having n digits, the
diminished radix complement of the number N is
o (rn-1) – N
o For decimal numbers, r=10
o (r-1)’s complement = 9’s complement
o Example:
 9’s complement of N = 546700
 = 999999-546700 = 453299

20
Diminished Radix Complement (cont)

o For binary numbers, r=2


o (r-1)’s complement = 1’s complement
o Example:
 1’s complement of N = 1011000
 = 1111111-1011000 = 0100111

21
Radix Complement
o Given a number N in base r having n digits, the
diminished radix complement of the number N is
o rn – N for N≠0
o For decimal numbers, r=10
o r’s complement = 10’s complement
o Example:
 10’s complement of N = 546700
 = 1000000-546700 = 453300

22
Radix Complement (cont)
o For binary numbers, r=2
o r’s complement = 2’s complement
o Example:
 2’s complement of N = 1011000
 = 10000000-1011000 = 0101000

23
1’s Complement of Binary Numbers

o The 1’s complement of a binary number is


found by changing all 1s to 0s and all 0s to
1s .

1 1 1 0 1 0 0

0 0 0 1 0 1 1

24
2’s Complement of Binary Numbers

o The 2’s complement of a binary number is found


by ADDING 1 to LSB of the 1’s complement
o 2’s complement = (1’s complement )+ 1
1 1 1 0 1 0 0 Binary Number

0 0 0 1 0 1 1 1’s complement

1 Add 1
0 0 0 1 1 0 0 2’s complement
25
Subtraction with r’s complemnt
o Example
o X = (0101 0100)2
o Y = (0100 0011)2
o X- Y = ?
X= 0101 0100
2'S complement of Y= 1011 1101
Sum = 1 0001 0001
Discard end carry 28= -1 0000 0000
Answer 0001 0001
26

You might also like