0% found this document useful (0 votes)
67 views

Lecture 1 - Number Systems

This document provides an introduction to different number systems used in computing including decimal, binary, octal, and hexadecimal. It discusses the base and digits used in each system and provides examples. The lecture agenda is outlined which will cover number bases, conversions between bases, and 1's and 2's complement. The module leader and learning objectives are introduced.

Uploaded by

robin kc
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views

Lecture 1 - Number Systems

This document provides an introduction to different number systems used in computing including decimal, binary, octal, and hexadecimal. It discusses the base and digits used in each system and provides examples. The lecture agenda is outlined which will cover number bases, conversions between bases, and 1's and 2's complement. The module leader and learning objectives are introduced.

Uploaded by

robin kc
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 85

iAcademy

Number systems

Computing Mathematics and Digital logic


Lecture 1

Introduction and Overview of Module


Introduction to Number systems
This lecture and its associated materials have been produced by Mr. Ashok Dhungana (M.Sc IT, Tribhuvan University) of
iAcademy for the purposes of lecturing on the above described subject and the material should be viewed in this
context. The work does not constitute professional advice and no warranties are made regarding the information
presented. The Author and iAcademy do not accept any liability for the consequences of any action taken as a result of
the work or any recommendations made or inferred. Permission to use any of these materials must be first granted by
iAcademy.
iAcademy
iAcademy

Agenda:
• Module Introduction
 Your Module Leader
 Module Objective
 Module Assessments and Syllabus Summary
 Recommended booklist
• Week 1 Lecture Coverage
 Different number bases
 Conversions between different bases
 1’s and 2’s complement
2
iAcademy
iAcademy

Module Leader
• Mr. Prakash Adhikari
(M.Ed Mathematics, TU, Nepal)
(Master’s Degree by research, Computer Sciences, University
of Lumire, France)
– Senior Lecturer, Islington College,
Nepal
[email protected]

3
iAcademy
iAcademy

Your Module Lecturer & Tutor

4
iAcademy
iAcademy

Introduction to the Module:


• Overview of Module
– What can you expect?
• Learning Objectives
– How will you benefit?
• Learning Strategy
– How you will learn?
• Assessment Overview
– How you will be tested?

5
iAcademy
iAcademy

Overview of Module:
• Computing mathematics and digital logic
• Aim: This module seeks to consolidate and improve
students’ mathematical knowledge, skills and concepts
through practical, analytical, problem Solving
applications and through integration with other
modules. This module introduces, and in some cases
reviews, the mathematical foundations of Computer
science.

6
iAcademy
iAcademy

Overview of Module (Contd.):


Syllabus :
 Number bases
 Sets ,Relations and Functions
 Methods of proof
 Propositional logic
 Boolean Algebra and logic circuits
 Simplification of Boolean functions using laws and k- maps
 Combinational logic circuits
 Sequential logic circuits
7
iAcademy
iAcademy

Learning
Objectives:

Computer
Hardware

Programming
Databases
Design Computer graphics
Computing Mathematics and Digital logic
8
iAcademy
iAcademy

Learning Strategy:
Computing Mathematics and Digital logic
• Taught over 1 semester (12 weeks )
• Total 12 weeks of class (1 academic semester)
• Each week consists of 1 Lecture (2 Hours) and 2
tutorials (1.5 Hours each)
– Lecture: Learn how to acquire different
mathematical skills
– Tutorial: Review and practice mathematical
problems through in-class assignments to actually
acquire them
9
iAcademy
iAcademy

Recommended Text Books:


 P. Grossman
Discrete Mathematics for computing
(2nd Edition) ,Macmillan 2002

 M.Morris Mano ,Charles R.Kime


Logic and Computer Design Fundamentals
(4th Edition) Pearson Prentice-Hall 2008

10
iAcademy
iAcademy

Learning Strategy:

Attendance for all classes is


important!
• Mathematics cannot be learnt by memorizing. It is
learnt through constant practice.
• We want to provide you the environment to practice
and improve quickly.

11
iAcademy
iAcademy

Assessment Details:
Computing Mathematics and Digital Logic
• 2 written examinations
• All assessments on an individual basis
– Mid-term Examination (Week 7, Weightage-30 %)
– Final Examination (Week 13/14, Weithtage-70 %)

12
iAcademy
iAcademy

Assessment Details:
• Module Grading Standards in the UK
Range of
Grade Remarks
Marks
Excellent: outstanding performance with only minor
70 - 100 A
errors
Very Good: above the average standard but with
60 – 69 B
some errors
Good: generally sound work with a number of
50 - 59 C
notable errors
43 - 49 D Satisfactory: fair but with significant shortcomings
40 - 42 E Sufficient: performance meets the minimum criteria
Fail: performance does not meet the minimum
0 - 39 F
criteria and considerable further work is required

13
iAcademy
iAcademy

Any Questions?

14
iAcademy
iAcademy

Let’s get started with Lecture 1:

An Introduction to Number Systems


15
iAcademy
iAcademy

But First… Lets see some


examples of why Mathematics is
Important!

16
iAcademy
iAcademy

What can we learn from these 4 videos?


• Why mathematics is important ?
• When not knowing math can cost you $15,000
• How to embarrass your math teacher?
• 10 reasons you should study math

17
iAcademy
iAcademy

• Why Mathematics is Important???

18
iAcademy
iAcademy

When not knowing math can cost you $15,000

19
iAcademy
iAcademy

• How to embarrass your math teacher?

20
iAcademy
iAcademy

• 10 reasons you should study math

21
iAcademy
iAcademy

Lecture 1 Coverage:
 Number Base System
o Decimal Number System
o Binary Number System
o Octal Number System
o Hexadecimal Number System

 Number Base Conversion


 1’s and 2’s Complement
22
iAcademy
iAcademy

Decimal Number System:


• Our everyday number system.
• The Base-10 number system
• It has 10 digits to show all numbers
0,1,2,3,4,5,6,7,8,9
• Can be expressed as the power of base 10.

• Example : 12510 or simply, 125

15010 or simply, 150

23
iAcademy
iAcademy

Binary Number System:


• Computers use binary numbers and therefore use
binary digits in place of decimal digits.
• The word bit is a shortening of the words "Binary
digIT."
• bits have only two possible values: 0 and 1.

• Example: 10012, 11010012,112 etc.

24
iAcademy
iAcademy

Hexadecimal Number System:


• The word "Hexadecimal" means "based on 16“

• There are 16 Hexadecimal digits

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, and E
• Example: 2E6, D13E, ABC, etc.

25
iAcademy
iAcademy

In Summary..
System Base Digits Example
Decimal 10 0, 1, … 9 12 , 2300

Binary 2 0, 1 1002, 11011112

Octal 8 0, 1, … 7 1048, 10348, 798

Hexa- 0, 1, … 9,
16 2AE, 34816
decimal A, B, … F

26
iAcademy
iAcademy

Counting (1 of 2):
Decimal Binary Octal Hexa-decimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
27
iAcademy
iAcademy

Counting (2 of 2):
Decimal Binary Octal Hexa-decimal
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
28
iAcademy
iAcademy

Any Questions?

29
iAcademy
iAcademy

Bases Conversion:
• The conversion possibilities:

Decimal Octal

Binary Hexadecimal

30
iAcademy
iAcademy

Binary to Decimal (1):

Decimal Octal

Binary Hexadecimal

31
iAcademy
iAcademy

Binary to Decimal (2):


• Technique
– Multiply each bit by 2n, where n = 0,1,2,3,……,n

– The weight is the position of the bit, starting from 0


on the right
– Add the results

32
iAcademy
iAcademy

Binary to Decimal (3) – Example:


1010112 = ?10
Bit
“0”

1010112 => 1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
4310
33
iAcademy
iAcademy

Octal to Decimal (1):

Decimal Octal

Binary Hexadecimal

34
iAcademy
iAcademy

Octal to Decimal (2):


• Technique
– Multiply each bit by 8n, where n = 0,1,2,3,……..,n

– The weight is the position of the bit, starting from 0


on the right
– Add the results

35
iAcademy
iAcademy

Octal to Decimal (3) – Example:


7248 = ?10

7248 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
46810

36
iAcademy
iAcademy

Hexadecimal to Decimal (1):

Decimal Octal

Binary Hexadecimal

37
iAcademy
iAcademy

Hexadecimal to Decimal (2)


• Technique
– Multiply each bit by 16n, where n= 0,1,2,3,…….n

– The weight is the position of the bit, starting from 0


on the right
– Add the results

38
iAcademy
iAcademy

Hexadecimal to Decimal (3)-Example

ABC16 = ?10

ABC16 => C x 160 = 12 x 1 = 12


B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
274810

39
iAcademy
iAcademy

Decimal to Binary (1):

Decimal Octal

Binary Hexadecimal

40
iAcademy
iAcademy

Decimal to Binary (2):


• Technique
– Divide by two, keep track of the remainder
– First remainder is bit 0 (LSB, least-significant bit)
– Second remainder is bit 1

41
iAcademy
iAcademy

Decimal to Binary (3) – Example:


12510 = ?2
2 125
2 62 1
2 31 0
2 15 1
2 7 1
2 3 1
2 1 1
0 1

12510 = 11111012
42
iAcademy
iAcademy

Octal to Binary (1):

Decimal Octal

Binary Hexadecimal

43
iAcademy
iAcademy

Octal to Binary (2):


• Technique
– Convert each octal digit to a 3-bit equivalent binary
representation

44
iAcademy
iAcademy

Octal to Binary (3) – Example:


7058= ?2

7 0 5

111 000 101

7058= 1110001012

45
iAcademy
iAcademy

Hexadecimal to Binary (1)

Decimal Octal

Binary Hexadecimal

46
iAcademy
iAcademy

Hexadecimal to Binary (2)


• Technique
– Convert each hexadecimal digit to a 4-bit equivalent
binary representation

47
iAcademy
iAcademy

Hexadecimal to Binary (3) – Example:


10AF16= ?2

1 0 A F

0001 0000 1010 1111

10AF16 = 00010000101011112

48
iAcademy
iAcademy

Decimal to Octal (1):

Decimal Octal

Binary Hexadecimal

49
iAcademy
iAcademy

Decimal to Octal (2)


• Technique
– Divide by 8

– Keep track of the remainder

50
iAcademy
iAcademy

Decimal to Octal (3) – Example:


123410 = ?8

8 1234
8 154 2
8 19 2
8 2 3
0 2

123410 = 23228

51
iAcademy
iAcademy

Decimal to Hexadecimal (1):

Decimal Octal

Binary Hexadecimal

52
iAcademy
iAcademy

Decimal to Hexadecimal (2)


• Technique
– Divide by 16

– Keep track of the remainder

53
iAcademy
iAcademy

Decimal to Hexadecimal (3) – Example:


123410 = ?16
16 1234
16 77 2
16 4 13 = D
16 0 4

123410 = 4D216

54
iAcademy
iAcademy

Binary to Octal (1):

Decimal Octal

Binary Hexadecimal

55
iAcademy
iAcademy

Binary to Octal (2):


• Technique
– Group bits in threes, starting on right

– Convert to octal digits

56
iAcademy
iAcademy

Binary to Octal (3) – Example:


10110101112 = ?8

1 011 010 111

1 3 2 7

10110101112 = 13278

57
iAcademy
iAcademy

Binary to Hexadecimal (1):

Decimal Octal

Binary Hexadecimal

58
iAcademy
iAcademy

Binary to Hexadecimal (2):


• Technique
– Group bits in fours, starting on right

– Convert to hexadecimal digits

59
iAcademy
iAcademy

Binary to Hexadecimal (3) – Example:


10101110112 = ?16

10 1011 1011

2 B B

10101110112 = 2BB16

60
iAcademy
iAcademy

Octal to Hexadecimal (1):

Decimal Octal

Binary Hexadecimal

61
iAcademy
iAcademy

Octal to Hexadecimal (2):


• Technique
– Use binary as an intermediary

– Group 4 bits starting from right

62
iAcademy
iAcademy

Octal to Hexadecimal (3) – Example:


10768 = ?16

1 0 7 6

001 000 111 110


2 3 E

10768 = 23E16

63
iAcademy
iAcademy

Hexadecimal to Octal (1):

Decimal Octal

Binary Hexadecimal

64
iAcademy
iAcademy

Hexadecimal to Octal (2):


• Technique
– Use binary as an intermediary

– Group 3 bits starting from right

65
iAcademy
iAcademy

Hexadecimal to Octal (3) – Example:


1F0C16 = ?8

1 F 0 C

0001 1111 0000 1100


1 7 4 1 4

1F0C16 = 174148

66
iAcademy
iAcademy

Any Questions?

67
iAcademy
iAcademy

Exercise – Convert and fill the table.

Decimal Binary Octal Hexa-decimal

35
1111101
605
10A

Don’t use a calculator!


68
iAcademy
iAcademy

Exercise – Answers:

Decimal Binary Octal Hexa-decimal

35 100011 43 23
125 1111101 175 7D
389 110000101 605 185
266 000100001010 412 10A

69
iAcademy
iAcademy

Fractional numbers
Decimal to binary
3.14579 = 3 + 0.14579 .14579
x 2
3.14579 0.29158
x 2
0.58316
x 2
1.16632
x 2
0.33264
x 2
0.66528
x 2
11.001001.. 1.33056
etc.
70
iAcademy
iAcademy

Exercise – Convert and fill the table

Decimal Binary Octal Hexa-decimal

30.8
110.1100
5.45
F.34

Don’t use a calculator!

71
iAcademy
iAcademy

Any Questions?

72
iAcademy
iAcademy

2’s Complement Arithmetic:


• Is subtracting one number from another is the same as
making one number negative and adding?
• How to create negative numbers in the binary number
system?
• The 2’s Complement Process.
• How the 2’s complement process can be use to add
(and subtract) binary numbers?

73
iAcademy
iAcademy

Negative Numbers?
• Digital electronics requires frequent addition and
subtraction of numbers. You know how to design an
adder, but what about a subtract-er?
• A subtract-er is not needed with the 2’s complement
process. The 2’s complement process allows you to
easily convert a positive number into its negative
equivalent.
• Since subtracting one number from another is the same
as making one number negative and adding, the need
for a subtract-er circuit has been eliminated.

74
iAcademy
iAcademy

2’s Complement Process:


The steps in the 2’s Complement process are similar to
the 10’s Complement process. However, you will now
use the base two.
First, complement all of the digits in a number.
• A digit’s complement is the number you add to the digit to
make it equal to the largest digit in the base (i.e., 1 for
binary). In binary language, the complement of 0 is 1, and
the complement of 1 is 0.
Second, add 1.
• Without this step, our number system would have two
zeroes (+0 & -0), which no number system has.
75
iAcademy
iAcademy

2’s Complement Examples:


5 = 00000101
 Complement Digits
11111010
+1 Add 1
-5 = 11111011

-13 = 11110011
Example #2 Complement Digits

00001100
+1 Add 1
13 = 00001101
76
iAcademy
iAcademy

Using The 2’s Complement Process:

POS 9 NEG (-9)


+ POS  + 5 + POS  + 5
POS 14 NEG -4

POS 9 NEG (-9)


+ NEG  + (-5) + NEG  + (-5)
POS 4 NEG - 14

77
iAcademy
iAcademy

POSITIVE + POSITIVE→ POSITIVE Answer:


If no 2s Complement is needed, use regular binary addition

9  00001001
+ 5  + 00000101
14  00001110

78
iAcademy
iAcademy

POSITIVE + NEGATIVE→ POSITIVE Answer:


Take the 2’s complement of the negative number and use regular
binary addition.

9  00001001
+ (-5) + 11111011
4  1]00000100
8th Bit = 0: Answer is Positive Disregard 9 th Bit

00000101
 2’s
11111010 Complement
+1 Process
11111011
79
iAcademy
iAcademy

POSITIVE + NEGATIVE→ NEGATIVE Answer:


Take the 2’s complement of the negative number and use regular
binary addition.

(-9) 11110111
+ 5  + 00000101
-4  11111100
8th Bit = 1: Answer is Negative

To Check: 11111100 00001001


Perform 2’s   2’s
Complement 00000011 11110110 Complement
On Answer +1 +1 Process
00000100 11110111
80
iAcademy
iAcademy

NEGATIVE + NEGATIVE→ NEGATIVE Answer:


Take the 2’s complement of both negative numbers and use regular
binary addition.

(-9)  11110111 2’s


+ (-5)  + 11111011 Complement
-14  1]11110010 Numbers,
See
8th Bit = 1: Answer is Conversion
To Check: 11110010 Negative Process
Perform 2’s  Disregard 9th Bit In Previous
Complement 00001101
Slides

On Answer +1
00001110
81
iAcademy
iAcademy

Any Questions?

82
iAcademy
iAcademy

Summary: Week 1 Lecture:


 Number Base System
o Decimal Number System
o Binary Number System
o Octal Number System
o Hexadecimal Number System

 Number Base Conversion


 1’s and 2’s Complement
83
iAcademy
iAcademy

What to Expect: Week 1 Tutorials


• Review and practice base conversion problems through
in-class assignments to actually acquire them
• Practice problems to know how computer performs
addition and subtraction using 2’s complement .

84
iAcademy
iAcademy

Thank you

iAcademy

You might also like