Anda di halaman 1dari 48

Lecture Notes 3

Department of Computer Science and Engineering


Course: CSC103 Fundamental Computer and Applications

NUMBER SYSTEM
Given By- Lecturer Fardina Fathmiul Alam
CSE Dept. IUBAT

Department of Computer Science and Engineering

NUMBER SYSTEMS

Humans vs. Computers:


It is not surprising that our number system is
based on units of TEN
Since nature provided man with five fingers on
each of 2 hands.
Computers use binary
They have only electronic or electromechanical
switches.
These switches have only 2 states, either ON
or OFF
CSC103 Fundamental Computer and Applications

2
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

What is Number ?
A number is a mathematical object used to count,
label, and measure. In mathematics, the definition of
number has been extended over the years to include
such numbers as zero, negative numbers, rational
numbers, irrational numbers, and complex numbers.

CSC103 Fundamental Computer and Applications

3
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

What is Number System?


A numeral system (or number system) is a writing
system for expressing numbers, that is,
a mathematical notation for representing numbers of a
given set, using digits or other symbols in a consistent
manner.
Ideally, a numeral system will:
Represent a useful set of numbers (e.g.
allintegers, orrational numbers)
Give every number represented a unique
representation (or at least a standard
representation)
Reflect the algebraic and arithmetic
4
CSC103 Fundamental Computer and Applications
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

Digit vs Number
Digit - any one of the ten numbers 0 to 9
Number - can be a combination of more digits

CSC103 Fundamental Computer and Applications

5
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

What is Bit?
Computers represent numbers as a series
of switches which store a pattern of ON's &
OFF's, representing the binary digits 1 & 0.
Each of these digits is called a BIT (BInary
digiT) .
In binary system, 0 and 1 is called a Bit
MSB
LSB
7
6
5
4
3
2
1
0
1

CSC103 Fundamental Computer and Applications

1
6
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

What is Number System?


A number system has base r or radix r.
One or more digits are combined to get a number.
The base of the number decides the valid digits that
are used to make a number.
In a number, the position of digit starts from the
right-hand side of the number. The rightmost digit has
position 0, the next digit on its left has position 1, and
so on.

CSC103 Fundamental Computer and Applications

7
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

There are 4 popular number systems in connection


with digital computers. They are:

1.Decimal Systems
2.Binary Systems
3.Octal Systems
4.Hexadecimal Systems

CSC103 Fundamental Computer and Applications

8
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

Distinguishing Number Systems


The characteristic which distinguish one number
system from another is called the base (or radix) .
The base or radix, of a number system is:
The number of different digits that can occur in
each position in the number system.
This is the number of symbols in a system
Example: Base 10 - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
CSC103 Fundamental Computer and Applications

9
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

Positional notations
In general, the relationship between a digit, its
position & the base of the number system is
expressed by the following formula:
DIGIT BASE ^POSITION

CSC103 Fundamental Computer and Applications

10
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

General Equation for number systems

N = anrn + an-1rn-1 + + a1r1 + a0r0


Where:
N: an integer with n+1 digits
r: base
ai is the set that contains {0, 1, 2, , r-1}
CSC103 Fundamental Computer and Applications

11
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

Decimal Number Systems


The decimal numeral system (also called base ten or
occasionally denary) has ten as its base.
It is the numerical base most widely used by
modern civilizations. Means these are the regular
numbers that we use.
The base is 10
Example: Base 10 - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

CSC103 Fundamental Computer and Applications

12
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

Decimal Number Systems


Place Value:
Place value is a positional system of notation in
which the position of a number with respect to a point
determines its value.
In the decimal (base ten) system, the value of the
digits is based on the number ten.

CSC103 Fundamental Computer and Applications

13
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

Decimal Number Systems


Place Value:
Each position in a decimal number has a value that
is a power of 10.
A decimal point separates the non-negative powers
of 10
(
10^0=1,
here 10=base , 0 to 3 are position
10^1=10,
10^2=100,
10^3=1,000,
14
etc.)
Topic: NUMBER SYSTEM

CSC103 Fundamental Computer and Applications

Department of Computer Science and Engineering

NUMBER SYSTEMS

Decimal Number Systems


Place Value:
On the left from the negative exponents
(
10^-1=1/10, here 10=base , -1 to -3 are position
10^-2=1/100,
10^-3=1/1000,
etc.)
on the right.

CSC103 Fundamental Computer and Applications

15
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

Decimal Number Systems

CSC103 Fundamental Computer and Applications

16
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

Decimal Number Systems

CSC103 Fundamental Computer and Applications

17
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

Decimal Number Systems


The number 512.49 in base 10 means:
512.49 = 500 + 10 + 2 + 0.40 + 0.09
= (5100)+(110) + (21) + (4 0.1)+(9 0.001)
= (510^2) + (110^1) + (210^0) + (4 10^-1 )
+(910^-2)

CSC103 Fundamental Computer and Applications

18
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

Binary Number Systems


Base of the binary number system is 2
Symbols are 0 & 1
B denotes binary prefix.
Computer systems are constructed of digital
electronics.
That means that their electronic circuits can exist in
only one of two states: on or off.

CSC103 Fundamental Computer and Applications

19
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

Binary Number Systems


Most computer electronics use voltage levels to
indicate their present state.
For example, a transistor with five volts would be
considered "on", while a transistor with no voltage
would be considered "off.

CSC103 Fundamental Computer and Applications

20
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

Binary Number Systems


These patterns of "on" and "off" stored inside the
computer are used to encode numbers using the binary
number system. as patterns of 1's and 0's.
Because of their digital nature, a computer's
electronics can easily manipulate numbers stored in
binary by treating 1 as "on" and 0 as "off."

CSC103 Fundamental Computer and Applications

21
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

WHAT IS BIT?

which is used for the term of binary digit.


It is also an unit to denote the memory capacity of a
computer.

CSC103 Fundamental Computer and Applications

22
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

Binary Number Systems


These patterns of "on" and "off" stored inside the
computer are used to encode numbers using the binary
number system. as patterns of 1's and 0's.
Because of their digital nature, a computer's
electronics can easily manipulate numbers stored in
binary by treating 1 as "on" and 0 as "off."

CSC103 Fundamental Computer and Applications

23
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

Binary Number Systems


These patterns of "on" and "off" stored inside the
computer are used to encode numbers using the binary
number system. as patterns of 1's and 0's.
Because of their digital nature, a computer's
electronics can easily manipulate numbers stored in
binary by treating 1 as "on" and 0 as "off."

CSC103 Fundamental Computer and Applications

24
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

In Decimal Number Systems


Digits are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Oops! There
are no more digits left.
We add a second column of digits, worth ten times
the value of the first column. Start counting again: 10,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19
20, 21, 22, ... , 94, 95, 96, 97, 98, 99 Oops! Once
again, there are no more digits left.

CSC103 Fundamental Computer and Applications

25
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

In Decimal Number Systems


Digits are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Oops! There
are no more digits left.
We add a second column of digits, worth ten times
the value of the first column. Start counting again: 10,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19
20, 21, 22, ... , 94, 95, 96, 97, 98, 99 Oops! Once
again, there are no more digits left.

CSC103 Fundamental Computer and Applications

26
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

In Binary Number Systems


The binary number system works in the exact same
way as the decimal system, except that it contains
only two digits, 0 and 1.
Start counting in binary: 0, 1, Oops! There are no
more binary digits. we need to add a second column
worth twice the value of the column before.

CSC103 Fundamental Computer and Applications

27
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

In Binary Number Systems


Counting again: 10, 11, Oops! It is time to add
another column again.
Counting further: 100, 101, 110, 111, 1000, 1001,
1010, 1011, 1100, 1101, 1110, 1111....

CSC103 Fundamental Computer and Applications

28
Topic: NUMBER SYSTEM

27

26

25

24

23

22

21

20

128

64

32

16

Equivale
nt
to

27

26

25

24

23

22

21

20

128

64

32

16

10

11

12

13

14

15

Equivale
nt
to

Department of Computer Science and Engineering

NUMBER SYSTEMS

In Binary Number Systems


Examples:
101012= 10101B =
124+023+122+021+120=
16+4+1= 21
101112= 10111B =
124+023+122+121+120=
16+4+2+1= 23
1000112= 100011B =
32
5 Computer and
4 Applications 3
2
1
0 Topic: NUMBER SYSTEM
CSC10312
Fundamental
+02 +02 +02 +12 +12 =32

Department of Computer Science and Engineering

NUMBER SYSTEMS

In Binary Number Systems


The number 1101.11 in base 2 means:
1101.01
= (12^3)+(12^2)+(02^1)+(12^0)+(02^-1)
+ (12^-2)
=8+4+0+1+0+(0.25)
=13+.25
=13.25

CSC103 Fundamental Computer and Applications

33
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

In Octal Number Systems


The octal numeral system, or oct for short, is
the base-8 number system, and uses the digits 0 to 7.
Base of the octal number system is 8
The symbols are 0, 1, 2, 3, 4, 5, 6 & 7

CSC103 Fundamental Computer and Applications

34
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

NUMBER SYSTEMS

In Octal Number Systems


Octal numerals can be made from binary numerals
by grouping consecutive binary digits into groups of
three (starting from the right).
For example, the binary representation for decimal
74 is 1001010, which can be grouped into (00)1 001
010 so the octal representation is 112.

CSC103 Fundamental Computer and Applications

35
Topic: NUMBER SYSTEM

NUMBER SYSTEMS

Department of Computer Science and Engineering

In Octal Number Systems


In the decimal system each decimal place is a power
of ten. For example:

In the octal system each place is a power of eight.


For example:

CSC103 Fundamental Computer and Applications

36
Topic: NUMBER SYSTEM

NUMBER SYSTEMS

Department of Computer Science and Engineering

In Octal Number Systems


The number 456.41 in base 8 means:
475.01 =(48^2)+(78^1)+(58^0)+(08^-1)+(1
8^-2)

CSC103 Fundamental Computer and Applications

37
Topic: NUMBER SYSTEM

NUMBER SYSTEMS

Department of Computer Science and Engineering

In Octal Number Systems


In mathematics and computer science:
hexadecimal (also base 16, or hex) is
a positional numeral system with a radix, or base, of
16.
It uses sixteen distinct symbols, most often the
symbols 09 to represent values zero to nine, and A,
B,C,D,E,F (or alternatively af) to represent values
ten to fifteen.

CSC103 Fundamental Computer and Applications

38
Topic: NUMBER SYSTEM

NUMBER SYSTEMS

Department of Computer Science and Engineering

In Octal Number Systems


The base is 16
The symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C,
D, E, F

CSC103 Fundamental Computer and Applications

39
Topic: NUMBER SYSTEM

NUMBER SYSTEMS

Department of Computer Science and Engineering

In Octal Number Systems


For example, the hexadecimal number
2AF3 is equal, in decimal, to
(216^3) + (1016^2) + (1516^1) + (316^0),
or =10995.
Each hexadecimal digit represents four binary digits
(bits)

CSC103 Fundamental Computer and Applications

40
Topic: NUMBER SYSTEM

NUMBER SYSTEMS

Department of Computer Science and Engineering

In Hexadecimal Number Systems


In mathematics and computer science
hexadecimal (also base 16, or hex) is a positional numeral
system with a radix, or base, of 16.
It uses sixteen distinct symbols, most often the
symbols 09 to represent values zero to nine, and A,B,C,
D,E,F (or alternatively af) to represent values ten to
fifteen.

CSC103 Fundamental Computer and Applications

41
Topic: NUMBER SYSTEM

NUMBER SYSTEMS

Department of Computer Science and Engineering

In Hexadecimal Number Systems


The base is 16
The symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E,
F

CSC103 Fundamental Computer and Applications

42
Topic: NUMBER SYSTEM

27

26

25

24

23

22

21

20

128

64

32

16

Equivale
nt
to

27

26

25

24

23

22

21

20

128

64

32

16

A (10)

B (11)

C (12)

D (13)

E (14)

F (15)

Equivale
nt
to

NUMBER SYSTEMS

Department of Computer Science and Engineering

In Hexadecimal Number Systems


For example, the hexadecimal number 2AF3 is equal, in
decimal, to (2163) + (10162) + (15161) + (3160),
or 10995.
Each hexadecimal digit represents four binary digits
(bits).
Hexadecimal is commonly used to represent
computer memory addresses.

CSC103 Fundamental Computer and Applications

45
Topic: NUMBER SYSTEM

NUMBER SYSTEMS

Department of Computer Science and Engineering

In Hexadecimal Number Systems


For example, the hexadecimal number 1FA.4C in
base 16 means:
1FA.4C =
(116^2)+(F16^1)+(A16^0)+(416^-1)+(C16^2)= (116^2)+(1516^1)+(1016^0)+(416^-1)
+(1216^-2)

CSC103 Fundamental Computer and Applications

46
Topic: NUMBER SYSTEM

Department of Computer Science and Engineering

BASE & DIGITS


Decimal

Binary

Octal

Hexadecimal

Digits

0,1,2,3,4,
5,6,7,8,9
(Total 10
digits)

0,1
(total 2
bits)

0,1,2,3,4,5,6,7
(total 0->7)

0,1,2,3,4,5,6,7,
8,9,A(10),B(11)
,C(12),D(13),E(
14),F(15)
(Total 0->F)

Base

10

16

Bit
Repres
entatio
n

1 bit

3 bit

Exampl
2010.021
e

1010.001

77.178

4 bit

1F.201016

CSC103 Fundamental Computer and Applications

47
Topic: NUMBER SYSTEM

The End