Number System
Number System
COMPUTING
Number System
Objectives
Data Representation
• To deal with the basic electronic states of on and off, von Neumann
suggested using the binary numbering system. His insight has vastly
simplified the way computers handle data.
Data Representation
Data Representation
The combination of 0s and 1s that represent characters are defined by patterns
called a coding scheme
• Numeric Data
▪ Used in arithmetic operations
• Binary Number System
▪ Has only two (2) digits : 0 and 1
▪ Allows computers to represent virtually any number simply by using 0s
and 1s
• ASCII
• American Standard Code for Information Interchange
▪ A superset of ASCII
• EBCDIC
▪ Extended Binary Coded Decimal Interchange Code
▪ An alternative 8-bit code used by IBM mainframe computers
• UNICODE
• Provides codes for 65,000 characters and makes use of 16 bits
Data Representation
• Bit
The smallest unit of data that a binary computer can
recognize (a single 1 or 0)
• Byte = 8 bits
Byte terminology used to express the size of documents and
other files, programs, etc.
• Nibble= 4 bits
A halfway between a little bit and a big byte
Data Representation
International Electrotechnical Commission (IEC) in 1999 introduced
these to specify binary quantities.
Data Representation
Source: https://physics.nist.gov/cuu/Units/binary.html
Numbering System Concepts
Numbering System is a way of representing numbers
nm-1…+n2+n1+n0.n-1+n-2+n-3…
Numbering System Concepts
Example :
• Given a base-n system and a number PQRST, the value is given by:
Tx1
+Sxn
+Rxnxn
+Qxnxnxn
+Pxnxnxnxn
Number System Concepts
Number System Concepts
1’s
multiplier
Number System Concepts
10
10’s
multiplier
Number System Concepts
100
0 1 2 3
4202 = 2x10 + 0x10 + 2x10 + 4x10
100’s
multiplier
Number System Concepts
1000
0 1 2 3
4202 = 2x10 + 0x10 + 2x10 + 4x10
1000’s
multiplier
Number System Concepts
0 1 2 3 4
10011 = 1x2 + 1x2 + 0x2 + 0x2 + 1x2
1
0 1 2 3 4
10011 = 1x2 + 1x2 + 0x2 + 0x2 + 1x2
1’s
multiplier
Number System Concepts
2
0 1 2 3 4
10011 = 1x2 + 1x2 + 0x2 + 0x2 + 1x2
2’s multiplier
Number System Concepts
4
0 1 2 3 4
10011 = 1x2 + 1x2 + 0x2 + 0x2 + 1x2
4’s multiplier
Number System Concepts
8
0 1 2 3 4
10011 = 1x2 + 1x2 + 0x2 + 0x2 + 1x2
8’s multiplier
Number System Concepts
16
0 1 2 3 4
10011 = 1x2 + 1x2 + 0x2 + 0x2 + 1x2
16’s
multiplier
Number System Concepts
m a l Octal
Deci
ma l
Binary
a deci
He x
Number System Conversion
m a l Octal
Deci
ma l
Binary
a deci
He x
Number System Conversion
Example 1: Octal to Decimal
m a l Octal
Deci
ma l
Binary
a deci
He x
Number System Conversion
m a l Octal
Deci
ma l
Binary
a deci
He x
Convert 75 to Binary
2 75 remainder
2 37 1
2 18 1
2 9 0
2 4 1
2 2 0
2 1 0
0 1
10010112
Check
0 1 2 3
1001011 = 1x2 + 1x2 + 0x2 + 1x2 +
4 5 6
0x2 + 0x2 + 1x2
= 1 + 2 + 0 + 8 + 0 + 0 + 64
= 75
Convert 100 to Binary
2 100 remainder
2 50 0
2 25 0
2 12 1
2 6 0
2 3 0
2 1 1
0 1
11001002
Converting Decimal fractions to Binary
carry
0.3125 x2 0
0.625 x2 1
1.25 x2 0
0.5 x2 1
1.0
0.3125 = 0.01012
Number System Conversion
m a l Octal
Deci
ma l
Binary
a deci
He x
Convert 2654 to Octal
8 2654 remainder
8 331 6
8 41 3
8 5 1
0 5
51368
Convert 266 to Octal
8 266 remainder
8 33 2
8 4 1
0 4
4128
Number System Conversion
m a l Octal
Deci
ma l
Binary
a deci
He x
Convert 2654 to Hexadecimal
16 2654 remainder
16 165 14 E
16 10 5
0 10 A
A5E16
Convert 1234 to Hexadecimal
16 1234 remainder
16 77 2
16 4 13 D
0 4
4D216
Number System Conversion
m a l Octal
Deci
ma l
Binary
a deci
He x
Convert 10112 to Octal
• Method 1
Solution:
b. Convert 11 to octal:
11/8 = 1 remainder 3
1/8 = 0 remainder 1
octal value = 138
Convert 101110112 to Octal
• Method 2
Solution:
2 7 3 101110112 = 2738
Convert 10110101112 to Octal
• Method 2
Solution:
1 3 2 7
10110101112 = 13278
Number System Conversion
m a l Octal
Deci
ma l
Binary
a deci
He x
Convert 101110112 to Hexadecimal
11 11
But 11 B16
101110112 = BB16
Convert 10110101112 to Hexadecimal
2 13 D 7
10110101112 = 2D716
Convert 11001010010101112 to Hexadecimal
12 C 10 A 5 7
11001010010101112 = CA5716
Number System Conversion
m a l Octal
Deci
ma l
Binary
a deci
He x
Convert 7058 to Binary
7058 = 1110001012
Number System Conversion
m a l Octal
Deci
ma l
Binary
a deci
He x
Convert 10AF16 to Binary
10AF16 = 10000101011112
Number System Conversion
m a l Octal
Deci
ma l
Binary
a deci
He x
Convert 10768 to Hexadecimal
1 0 7 6
10768 = 23E16
Number System Conversion
m a l Octal
Deci
ma l
Binary
a deci
He x
Convert 1F0C16 to Octal
1 F 0 C
1F0C16 = 174148