SlideShare a Scribd company logo
1 of 89
1
Lecture 2
Number Systems
ITEC 1000 “Introduction to Information Technology”
Prof. Peter Khaiter
Hexadecimal
Decimal Octal
Binary
2
Lecture Outline:
 Types of number systems
 Number bases
 Range of possible numbers
 Conversion between number bases
 Common powers
 Arithmetic in different number bases
 Shifting a number
3
Types of Number Systems
 Additive: Numbers have intrinsic value:
e.g.: Roman Numerals: LVIII = 50 + 5 + 1 + 1
+ 1 = 58
 Positional: Value depends on position: e.g.:
Decimal system: 55 = 5 x 10 + 5 x 1
 Additive Number Systems are not used
much any more:
Awkward to use.
Prone to errors.
4
Definitions
 The Base of a number system – how
many different digits (incl. zero) are
used in the system.
Base 2: 0, 1
Base 5: 0, 1, 2, 3, 4
Base 8: 0, 1, 2, 3, 4, 5, 6, 7
Base 10: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Base 16: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
5
Definitions
 Bit – a cell holding a single binary
number (0 or 1)
 Byte = 8 bits (can hold 28 = 256
different patterns/values)
 Word – a fixed-sized group of bits
that the computer handles together.
Typical word sizes: 4, 8, 16, 32, 64,
128 bits
 1K = 1024 bytes
6
Magnetic Core Memory
http://en.wikipedia.org/wiki/Computer
7
Common Number Systems
System Base Symbols
Used by
humans?
Used in
computers?
Decimal 10 0, 1, … 9 Yes No
Binary 2 0, 1 No Yes
Octal 8 0, 1, … 7 No Yes
Hexa-
decimal
16 0, 1, … 9,
A, B, … F
No Yes
8
Positional decimal system
The number 125 means:
1 group of 100 (100 = 102)
2 groups of 10 (10 = 101)
5 groups of 1 (1 = 100)
9
Place values (1 of 2)
In our usual positional number system, the
meaning of a digit depends on where it is
located in the number
3 groups of 1000
7 groups of 100
3 groups of 10
2 groups of 1
Example: 3 7 3 2
10
Place values (2 of 2)
12510 => 5 x 100 = 5
2 x 101 = 20
1 x 102 = 100
125
Base
Weight
11
Representing in bases: 10, 2, 8, 16
 86510 = 8 x 102 + 6 x 101 + 5 x 100 = 800
+ 60 + 5
 10112 = 1 x 23 + 0 x 22 + 1 x 21 + 1 x 20
= 8 + 2 + 1 = 1110
 258 = 2 x 81 + 5 x 80 = 16 + 5 = 2110
 A716 = 10 x 161 + 7 x 160 = 160 + 7 =
16710
Note: The subscript naming the base is
itself given in base ten (10), by
convention.
Base
12
Counting in bases (1 of 3)
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
13
Counting in bases (2 of 3)
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
14
Counting in bases (3 of 3)
Decimal Binary Octal
Hexa-
decimal
16 10000 20 10
17 10001 21 11
18 10010 22 12
19 10011 23 13
20 10100 24 14
21 10101 25 15
22 10110 26 16
23 10111 27 17
15
Estimating magnitude: Binary
1101 01102 = 21410
1101 01102 > 19210 (128 + 64 + additional bits to the right)
Place 27 26 25 24 23 22 21 20
Value 128 64 32 16 8 4 2 1
Evaluate 1 x 128 1 x 64 0 x 32 1 x16 0 x 8 1 x 4 1 x 2 0 x 1
Sum for
Base 10
128 64 0 16 0 4 2 0
16
Range of possible numbers
 R = BK where
R = range
B = base
K = number of digits
 Example #1: Base 10, 2 digits
R = 102 = 100 different numbers (0…99)
 Example #2: Base 2, 16 digits
R = 216 = 65,536 or 64K
16-bit PC can store 65,536 different number
values
17
Decimal Range for Bit Widths
Bits Digits Range
1 0+ 2 (0 and 1)
4 1+ 16 (0 to 15)
8 2+ 256
10 3+ 1,024 (1K)
16 4+ 65,536 (64K)
20 6+ 1,048,576 (1M)
32 9+ 4,294,967,296 (4G)
64 19+ Approx. 1.6 x 1019
128 38+ Approx. 2.6 x 1038
18
Conversion Among Bases
Hexadecimal
Decimal Octal
Binary
19
Binary to Decimal (1 of 3)
Hexadecimal
Decimal Octal
Binary
20
Binary to Decimal (2 of 3)
 Technique
Multiply each bit by 2n, where n is the
“weight” of the bit
The weight is the position of the bit, starting
from 0 on the right
Add the results
21
Binary to Decimal (3 of 3)
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
Bit “0”
22
Octal to Decimal (1 of 3)
Hexadecimal
Decimal Octal
Binary
23
Octal to Decimal (2 of 3)
 Technique
Multiply each bit by 8n, where n is the
“weight” of the bit
The weight is the position of the bit,
starting from 0 on the right
Add the results together
Note: 80 = 1, 81 = 8,
82 = 64 83 = 512, Etc.
24
Octal to Decimal (3 of 3)
7248 => 4 x 80 = 4 x 1 = 4
2 x 81 = 2 x 8 = 16
7 x 82 = 7 x 64 = 448
46810
25
Hexadecimal to Decimal (1 of 3)
Hexadecimal
Decimal Octal
Binary
26
Hexadecimal to Decimal (2 of 3)
 Technique
Multiply each bit by 16n, where n is the
“weight” of the bit
The weight is the position of the bit, starting
from 0 on the right
Add the results
Note: 160 = 1, 161 = 16,
162 = 256 163 = 4096, Etc.
27
Hexadecimal to Decimal (3 of 3)
ABC16 => C x 160 = 12 x 1 = 12
B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
274810
28
Decimal to Binary (1 of 3)
Hexadecimal
Decimal Octal
Binary
29
Decimal to Binary (2 of 3)
 Technique
Divide by two, keep track of the remainder
First remainder is bit 0 (LSB, least-significant
bit)
Second remainder is bit 1
Etc.
30
Decimal to Binary (3 of 3)
12510 = ?2 2 125
62 12
31 02
15 12
7 12
3 12
1 12
0 1
12510 = 11111012
31
Octal to Binary (1 of 3)
Hexadecimal
Decimal Octal
Binary
32
Octal to Binary (2 of 3)
 Technique
Convert each octal digit to a 3-bit
equivalent binary representation
See Table, Slides 12-14
33
Octal to Binary (3 of 3)
7058 = ?2
7 0 5
111 000 101
7058 = 1110001012
34
Hexadecimal to Binary (1 of 3)
Hexadecimal
Decimal Octal
Binary
35
Hexadecimal to Binary (2 of 3)
 Technique
Convert each hexadecimal digit to a 4-bit
equivalent binary representation
See Table, Slides 12-14
36
Hexadecimal to Binary (3 of 3)
10AF16 = ?2
1 0 A F
0001 0000 1010 1111
10AF16 = 00010000101011112
37
Decimal to Octal (1 of 3)
Hexadecimal
Decimal Octal
Binary
38
Decimal to Octal (2 of 3)
 Technique
Divide by 8
Keep track of the remainder
39
Decimal to Octal (3 of 3)
123410 = ?8
8 1234
154 28
19 28
2 38
0 2
123410 = 23228
40
Decimal to Hexadecimal (1 of 3)
Hexadecimal
Decimal Octal
Binary
41
Decimal to Hexadecimal (2 of 3)
 Technique
Divide by 16
Keep track of the remainder
42
Decimal to Hexadecimal (3 of 3)
123410 = ?16
123410 = 4D216
16 1234
77 216
4 13 = D16
0 4
43
Binary to Octal (1 of 3)
Hexadecimal
Decimal Octal
Binary
44
Binary to Octal (2 of 3)
 Technique
Group bits in threes, starting on right
Convert to octal digits
See Table, Slides 12-14
45
Binary to Octal (3 of 3)
10110101112 = ?8
1 011 010 111
1 3 2 7
10110101112 = 13278
46
Binary to Hexadecimal (1 of 3)
Hexadecimal
Decimal Octal
Binary
47
Binary to Hexadecimal (2 of 3)
 Technique
Group bits in fours, starting on right
Convert to hexadecimal digits
See Table, Slides 12-14
48
Binary to Hexadecimal (3 of 3)
10101110112 = ?16
10 1011 1011
2 B B
10101110112 = 2BB16
49
Octal to Hexadecimal (1 of 3)
Hexadecimal
Decimal Octal
Binary
50
Octal to Hexadecimal (2 of 3)
 Technique
Use binary as an intermediary
See Table, Slides 12-14
51
Octal to Hexadecimal (3 of 3)
10768 = ?16
1 0 7 6
001 000 111 110
2 3 E
10768 = 23E16
52
Hexadecimal to Octal (1 of 3)
Hexadecimal
Decimal Octal
Binary
53
Hexadecimal to Octal (2 of 3)
 Technique
Use binary as an intermediary
See Table, Slides 12-14
54
Hexadecimal to Octal (3 of 3)
1F0C16 = ?8
1 F 0 C
0001 1111 0000 1100
1 7 4 1 4
1F0C16 = 174148
55
Exercise – Convert ...
Don’t use a calculator!
Decimal Binary Octal
Hexa-
decimal
33
1110101
703
1AF
Skip answer Answer
56
Exercise – Convert (answers)
Decimal Binary Octal
Hexa-
decimal
33 100001 41 21
117 1110101 165 75
451 111000011 703 1C3
431 110101111 657 1AF
57
Common Powers (1 of 2)
 Base 10
Power Preface Symbol
10-12 pico p
10-9 nano n
10-6 micro 
10-3 milli m
103 kilo k
106 mega M
109 giga G
1012 tera T
Value
.000000000001
.000000001
.000001
.001
1000
1000000
1000000000
1000000000000
58
Common Powers (2 of 2)
 Base 2 Power Preface Symbol
210 kilo k
220 mega M
230 Giga G
Value
1024
1048576
1073741824
What is the value of “k”, “M”, and “G”?
In computing, particularly w.r.t. memory,
the base-2 interpretation generally applies
59
Example
/ 230 =
1. Double click on My Computer
2. Right click on C:
3. Click on Properties
60
Multiplying powers
 For common bases, add powers
26  210 = 216 = 65,536
or…
26  210 = 64  210 = 64k
ab  ac = ab+c
61
Table of powers
Power
Base 8 7 6 5 4 3 2 1 0
2
256 128 64 32 16 8 4 2 1
8
32,768 4,096 512 64 8 1
16
65,536 4,096 256 16 1
62
Fractions
 Number point or radix point
Decimal point in base 10
Binary point in base 2
 No exact relationship between
fractional numbers in different
number bases
Exact conversion may be impossible
63
Decimal fractions
 Move the number point one place to the
right
Effect: multiplies the number by the base
number
Example: 139.010 139010
 Move the number point one place to the
left
Effect: divides the number by the base
number
Example: 139.010 13.910
64
Fractions: Base 10
Place 10-1 10-2 10-3 10-4
Value 1/10 1/100 1/1000 1/10000
Evaluate 2 x 1/10 5 x 1/100 8 x 1/1000 9 x1/10000
Sum .2 .05 .008 .0009
.258910
10-1 10-2 10-3 10-4
65
Fractions: Base 2
.1010112 = 0.67187510
Place 2-1 2-2 2-3 2-4 2-5 2-6
Value 1/2 1/4 1/8 1/16 1/32 1/64
Evaluate 1 x 1/2 0 x 1/4 1x 1/8 0 x 1/16 1 x 1/32 1 x 1/64
Sum .5 0.125 0.03125 0.015625
2-1 2-2 2-3 2-4 2-5 2-6
66
Fractions: Base 10 and Base 2
 No general relationship between fractions
of types 1/10k and 1/2k
Therefore a number representable in base 10
may not be representable in base 2
But: the converse is true: all fractions of the
form 1/2k can be represented in base 10
 Fractional conversions from one base to
another are stopped
If there is a rational solution, or
When the desired accuracy is attained
67
Fractions: From Base B To Base 10
 Determine the appropriate weight for
each fractional digit as a negative power
of the base
 Multiply each digit by its weight
 Add the values
 Example:
.A116 = 10x16-1 + 1x16-2 = 10x0.0625 +
1x0.00390625 = 0.6289062510
68
Fractions: From Base 10 To Base B
 Multiply the fraction by the base
value B (i.e., 2, 8 or 16)
 Record the values that move to the
left of the radix point and drop them
 Repeat the process until
the value being multiplied is zero, or
the desired number of digits of
accuracy is attained
69
Fractions: From Base 10 To Base B
0.67312510 = ?2 0.673125
x 2
1.346250
x 2
0.692500
x 2
1.385000
x 2
0.770000
x 2
0.1010112 1.540000
x 2
1.080000
70
Fractions: From Base 2 To Base 8, 16
 Group digits from left to right in
groups of 3 (base 8) or 4 (base 16)
 Supplement the right-most group
with 0’s, if necessary
 Convert each group to the desired
base.
See Table, Slides 12-14
71
Fractions: From Base 8, 16 To Base 2
 Convert each octal (base 8) or
hexadecimal (base 16) digit to its 3-
bit or 4-bit representation
See Table, Slides 12-14
72
Fractions: between Base 8 and
Base 16
 Use binary conversion as an
intermediary
 Example:
0.C816 = ?8
1100 10002
6 2 0 0.C816 = 0.628
73
Mixed number conversion
 Convert whole part and fraction part
separately
See Table, Slides 12-14
74
Arithmetic operations (1 of 14)
 Binary Addition
Two 1-bit values
A B A + B
0 0 0
0 1 1
1 0 1
1 1 10
0 and carry 1 to the
next more
significant bit, i.e.
“two”
75
Arithmetic operations (2 of 14)
 Two n-bit values
Add individual bits (see Table)
Propagate carries
10101 21
+ 11001 + 25
101110 46
11
Note: superscripts are carried amounts.
76
Addition (different bases) (3 of 14)
Base Problem Largest Single Digit
Decimal
6
+3
9
Octal
6
+1
7
Hexadecimal
6
+9
F
Binary
1
+0
1
77
Addition (different bases) (4 of 14)
Base Problem Carry Answer
Decimal
6
+4
Carry the 10 10
Octal
6
+2
Carry the 8 10
Hexadecimal
6
+A
Carry the 16 10
Binary
1
+1
Carry the 2 10
78
Addition Table: Base 10 (5 of 14)
+ 0 1 2 3 4 5 6 7 8 9
0 0 1 2 3 4 5 6 7 8 9
1 1 2 3 4 5 6 7 8 9 10
2 2 3 4 5 6 7 8 9 10 11
3 3 4 5 6 7 8 9 10 11 12
4 4 5 6 7 8
etc
9 10 11 12 13
310 + 610 = 910
79
Addition Table: Base 8 (6 of 14)
+ 0 1 2 3 4 5 6 7
0 0 1 2 3 4 5 6 7
1 1 2 3 4 5 6 7 10
2 2 3 4 5 6 7 10 11
3 3 4 5 6 7 10 11 12
4 4 5 6 7 10 11 12 13
5 5 6 7 10 11 12 13 14
6 6 7 10 11 12 13 14 15
7 7 10 11 12 13 14 15 16
38 + 68 = 118
80
Arithmetic operations (7 of 14)
 Binary Subtraction
Two 1-bit values
A B A - B
0 0 0
0 1 1
1 0 1
1 1 0
and borrow 1 from
the next more
significant bit
81
Arithmetic operations (8 of 14)
 Two n-bit values
Subtract individual bits (see Table)
Keep track of the borrowings
00100101 – 00010001 = 00010100
00100101 3710
- 00010001 - 1710
00010100 2010
0 10
82
Arithmetic operations (9 of 14)
 Multiplication
Decimal (just for fun)
35
x 105
175
000
35
3675
83
Arithmetic operations (10 of 14)
 Binary multiplication, two 1-bit values
A B A  B
0 0 0
0 1 0
1 0 0
1 1 1
84
Arithmetic operations (11 of 14)
 Binary multiplication, two n-bit values
As with decimal values
1110
x 1011
1110
1110
0000
1110
10011010
85
Multiplication Table: Base 10 (12 of
14)
x 0 1 2 3 4 5 6 7 8 9
0 0
1 1 2 3 4 5 6 7 8 9
2 2 4 6 8 10 12 14 16 18
3 3 6 9 12 15 18 21 24 27
4 0 4 8 12 16 20 24 28 32 36
5 5 10 15 20 25 30 35 40 45
6 6 12 18 24 30 36 42 48 54
7 7 14 21 28 35 42 49 56 63
etc.
310 x 610 = 1810
86
Multiplication Table: Base 8 (13 of
14)
x 0 1 2 3 4 5 6 7
0 0
1 1 2 3 4 5 6 7
2 2 4 6 10 12 14 16
3 0 3 6 11 14 17 22 25
4 4 10 14 20 24 30 34
5 5 12 17 24 31 36 43
6 6 14 22 30 36 44 52
7 7 16 25 34 43 52 61
38 x 68 = 228
87
Arithmetic operations (14 of 14)
 Binary division, two n-bit values
As with decimal values
100001/11 = 1011 11 ) 100001
1011
11
00100
11
11
11
0
divisor
dividend
quotient
88
Shifting a number
 Shifting a decimal number to the left
by one position is equivalent to
multiplying by 10
 Shifting a binary number to the left by
one position is equivalent to multiplying
by 2
 General rule: shifting a number in any
base left one digit multiplies its value
by the base; shifting one digit right
divides its value by the base
89
Thank you!
Reading: Lecture slides and notes, Chapter 3

More Related Content

What's hot

Binaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemesBinaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemesDr. Anita Goel
 
Lecture 12 intermediate code generation
Lecture 12 intermediate code generationLecture 12 intermediate code generation
Lecture 12 intermediate code generationIffat Anjum
 
Looping statement in vb.net
Looping statement in vb.netLooping statement in vb.net
Looping statement in vb.netilakkiya
 
Homomorphic encryption on Blockchain Principles
Homomorphic encryption on Blockchain PrinciplesHomomorphic encryption on Blockchain Principles
Homomorphic encryption on Blockchain PrinciplesJohann Höchtl
 
Compiler Optimization Presentation
Compiler Optimization PresentationCompiler Optimization Presentation
Compiler Optimization Presentation19magnet
 
Intermediate code generation1
Intermediate code generation1Intermediate code generation1
Intermediate code generation1Shashwat Shriparv
 
Block Ciphers and the Data Encryption Standard
Block Ciphers and the Data Encryption StandardBlock Ciphers and the Data Encryption Standard
Block Ciphers and the Data Encryption StandardDr.Florence Dayana
 
AES KEY EXPANSION .pptx
AES KEY EXPANSION .pptxAES KEY EXPANSION .pptx
AES KEY EXPANSION .pptxAhmudulHassan
 
15CS44 MP &MC Module 3
15CS44 MP &MC Module 315CS44 MP &MC Module 3
15CS44 MP &MC Module 3RLJIT
 
Intro to modern cryptography
Intro to modern cryptographyIntro to modern cryptography
Intro to modern cryptographyzahid-mian
 
C formatted and unformatted input and output constructs
C  formatted and unformatted input and output constructsC  formatted and unformatted input and output constructs
C formatted and unformatted input and output constructsGopikaS12
 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language BasicsEducation Front
 
El Gamal Cryptosystem
El Gamal CryptosystemEl Gamal Cryptosystem
El Gamal CryptosystemAdri Jovin
 

What's hot (20)

Binaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemesBinaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemes
 
ch5-osi.pdf
ch5-osi.pdfch5-osi.pdf
ch5-osi.pdf
 
Lecture 12 intermediate code generation
Lecture 12 intermediate code generationLecture 12 intermediate code generation
Lecture 12 intermediate code generation
 
Looping statement in vb.net
Looping statement in vb.netLooping statement in vb.net
Looping statement in vb.net
 
Number Systems Basic Concepts
Number Systems Basic ConceptsNumber Systems Basic Concepts
Number Systems Basic Concepts
 
Homomorphic encryption on Blockchain Principles
Homomorphic encryption on Blockchain PrinciplesHomomorphic encryption on Blockchain Principles
Homomorphic encryption on Blockchain Principles
 
Cd lab manual
Cd lab manualCd lab manual
Cd lab manual
 
Compiler Optimization Presentation
Compiler Optimization PresentationCompiler Optimization Presentation
Compiler Optimization Presentation
 
Chapter 5 c
Chapter 5 cChapter 5 c
Chapter 5 c
 
Intermediate code generation1
Intermediate code generation1Intermediate code generation1
Intermediate code generation1
 
Block Ciphers and the Data Encryption Standard
Block Ciphers and the Data Encryption StandardBlock Ciphers and the Data Encryption Standard
Block Ciphers and the Data Encryption Standard
 
AES KEY EXPANSION .pptx
AES KEY EXPANSION .pptxAES KEY EXPANSION .pptx
AES KEY EXPANSION .pptx
 
15CS44 MP &MC Module 3
15CS44 MP &MC Module 315CS44 MP &MC Module 3
15CS44 MP &MC Module 3
 
TOC 10 | Turing Machine
TOC 10 | Turing MachineTOC 10 | Turing Machine
TOC 10 | Turing Machine
 
Intro to modern cryptography
Intro to modern cryptographyIntro to modern cryptography
Intro to modern cryptography
 
Programming Design Tools
Programming Design ToolsProgramming Design Tools
Programming Design Tools
 
C formatted and unformatted input and output constructs
C  formatted and unformatted input and output constructsC  formatted and unformatted input and output constructs
C formatted and unformatted input and output constructs
 
DES.ppt
DES.pptDES.ppt
DES.ppt
 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language Basics
 
El Gamal Cryptosystem
El Gamal CryptosystemEl Gamal Cryptosystem
El Gamal Cryptosystem
 

Similar to Introduction to Information Technology Lecture 2

01.number systems
01.number systems01.number systems
01.number systemsrasha3
 
Module 1 number systems and code1
Module 1  number systems and code1Module 1  number systems and code1
Module 1 number systems and code1Deepak John
 
Conversion of number system with base concept
Conversion of number system with base conceptConversion of number system with base concept
Conversion of number system with base conceptUniversity of Potsdam
 
Chapter two FHI.pptx
Chapter two FHI.pptxChapter two FHI.pptx
Chapter two FHI.pptxODAATUBE1
 
Chapter 1 digital design.pptx
Chapter 1 digital design.pptxChapter 1 digital design.pptx
Chapter 1 digital design.pptxAliaaTarek5
 
Number system....
Number system....Number system....
Number system....mshoaib15
 
Number Systems
Number SystemsNumber Systems
Number Systemsstudent
 
Number Systems
Number SystemsNumber Systems
Number Systemsstudent
 
Unit 1 PDF.pptx
Unit 1 PDF.pptxUnit 1 PDF.pptx
Unit 1 PDF.pptxChandraV13
 
Data representation
Data representationData representation
Data representationChew Hoong
 

Similar to Introduction to Information Technology Lecture 2 (20)

01.number systems
01.number systems01.number systems
01.number systems
 
Computer Number System
Computer Number SystemComputer Number System
Computer Number System
 
01.Number Systems
01.Number Systems01.Number Systems
01.Number Systems
 
01.number systems
01.number systems01.number systems
01.number systems
 
Binary number systems
Binary number systemsBinary number systems
Binary number systems
 
Module 1 number systems and code1
Module 1  number systems and code1Module 1  number systems and code1
Module 1 number systems and code1
 
Number systems r002
Number systems  r002Number systems  r002
Number systems r002
 
Conversion of number system with base concept
Conversion of number system with base conceptConversion of number system with base concept
Conversion of number system with base concept
 
5871320.ppt
5871320.ppt5871320.ppt
5871320.ppt
 
Digital Electronics Notes.pdf
Digital Electronics Notes.pdfDigital Electronics Notes.pdf
Digital Electronics Notes.pdf
 
Chapter two FHI.pptx
Chapter two FHI.pptxChapter two FHI.pptx
Chapter two FHI.pptx
 
ITC lecture 3.pptx
ITC lecture 3.pptxITC lecture 3.pptx
ITC lecture 3.pptx
 
Number systems
Number systemsNumber systems
Number systems
 
Chapter 1 digital design.pptx
Chapter 1 digital design.pptxChapter 1 digital design.pptx
Chapter 1 digital design.pptx
 
Number system....
Number system....Number system....
Number system....
 
Number Systems
Number SystemsNumber Systems
Number Systems
 
Number Systems
Number SystemsNumber Systems
Number Systems
 
Chapter 3.pptx
Chapter 3.pptxChapter 3.pptx
Chapter 3.pptx
 
Unit 1 PDF.pptx
Unit 1 PDF.pptxUnit 1 PDF.pptx
Unit 1 PDF.pptx
 
Data representation
Data representationData representation
Data representation
 

Recently uploaded

Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Recently uploaded (20)

Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

Introduction to Information Technology Lecture 2

  • 1. 1 Lecture 2 Number Systems ITEC 1000 “Introduction to Information Technology” Prof. Peter Khaiter Hexadecimal Decimal Octal Binary
  • 2. 2 Lecture Outline:  Types of number systems  Number bases  Range of possible numbers  Conversion between number bases  Common powers  Arithmetic in different number bases  Shifting a number
  • 3. 3 Types of Number Systems  Additive: Numbers have intrinsic value: e.g.: Roman Numerals: LVIII = 50 + 5 + 1 + 1 + 1 = 58  Positional: Value depends on position: e.g.: Decimal system: 55 = 5 x 10 + 5 x 1  Additive Number Systems are not used much any more: Awkward to use. Prone to errors.
  • 4. 4 Definitions  The Base of a number system – how many different digits (incl. zero) are used in the system. Base 2: 0, 1 Base 5: 0, 1, 2, 3, 4 Base 8: 0, 1, 2, 3, 4, 5, 6, 7 Base 10: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Base 16: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
  • 5. 5 Definitions  Bit – a cell holding a single binary number (0 or 1)  Byte = 8 bits (can hold 28 = 256 different patterns/values)  Word – a fixed-sized group of bits that the computer handles together. Typical word sizes: 4, 8, 16, 32, 64, 128 bits  1K = 1024 bytes
  • 7. 7 Common Number Systems System Base Symbols Used by humans? Used in computers? Decimal 10 0, 1, … 9 Yes No Binary 2 0, 1 No Yes Octal 8 0, 1, … 7 No Yes Hexa- decimal 16 0, 1, … 9, A, B, … F No Yes
  • 8. 8 Positional decimal system The number 125 means: 1 group of 100 (100 = 102) 2 groups of 10 (10 = 101) 5 groups of 1 (1 = 100)
  • 9. 9 Place values (1 of 2) In our usual positional number system, the meaning of a digit depends on where it is located in the number 3 groups of 1000 7 groups of 100 3 groups of 10 2 groups of 1 Example: 3 7 3 2
  • 10. 10 Place values (2 of 2) 12510 => 5 x 100 = 5 2 x 101 = 20 1 x 102 = 100 125 Base Weight
  • 11. 11 Representing in bases: 10, 2, 8, 16  86510 = 8 x 102 + 6 x 101 + 5 x 100 = 800 + 60 + 5  10112 = 1 x 23 + 0 x 22 + 1 x 21 + 1 x 20 = 8 + 2 + 1 = 1110  258 = 2 x 81 + 5 x 80 = 16 + 5 = 2110  A716 = 10 x 161 + 7 x 160 = 160 + 7 = 16710 Note: The subscript naming the base is itself given in base ten (10), by convention. Base
  • 12. 12 Counting in bases (1 of 3) 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
  • 13. 13 Counting in bases (2 of 3) 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
  • 14. 14 Counting in bases (3 of 3) Decimal Binary Octal Hexa- decimal 16 10000 20 10 17 10001 21 11 18 10010 22 12 19 10011 23 13 20 10100 24 14 21 10101 25 15 22 10110 26 16 23 10111 27 17
  • 15. 15 Estimating magnitude: Binary 1101 01102 = 21410 1101 01102 > 19210 (128 + 64 + additional bits to the right) Place 27 26 25 24 23 22 21 20 Value 128 64 32 16 8 4 2 1 Evaluate 1 x 128 1 x 64 0 x 32 1 x16 0 x 8 1 x 4 1 x 2 0 x 1 Sum for Base 10 128 64 0 16 0 4 2 0
  • 16. 16 Range of possible numbers  R = BK where R = range B = base K = number of digits  Example #1: Base 10, 2 digits R = 102 = 100 different numbers (0…99)  Example #2: Base 2, 16 digits R = 216 = 65,536 or 64K 16-bit PC can store 65,536 different number values
  • 17. 17 Decimal Range for Bit Widths Bits Digits Range 1 0+ 2 (0 and 1) 4 1+ 16 (0 to 15) 8 2+ 256 10 3+ 1,024 (1K) 16 4+ 65,536 (64K) 20 6+ 1,048,576 (1M) 32 9+ 4,294,967,296 (4G) 64 19+ Approx. 1.6 x 1019 128 38+ Approx. 2.6 x 1038
  • 19. 19 Binary to Decimal (1 of 3) Hexadecimal Decimal Octal Binary
  • 20. 20 Binary to Decimal (2 of 3)  Technique Multiply each bit by 2n, where n is the “weight” of the bit The weight is the position of the bit, starting from 0 on the right Add the results
  • 21. 21 Binary to Decimal (3 of 3) 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 Bit “0”
  • 22. 22 Octal to Decimal (1 of 3) Hexadecimal Decimal Octal Binary
  • 23. 23 Octal to Decimal (2 of 3)  Technique Multiply each bit by 8n, where n is the “weight” of the bit The weight is the position of the bit, starting from 0 on the right Add the results together Note: 80 = 1, 81 = 8, 82 = 64 83 = 512, Etc.
  • 24. 24 Octal to Decimal (3 of 3) 7248 => 4 x 80 = 4 x 1 = 4 2 x 81 = 2 x 8 = 16 7 x 82 = 7 x 64 = 448 46810
  • 25. 25 Hexadecimal to Decimal (1 of 3) Hexadecimal Decimal Octal Binary
  • 26. 26 Hexadecimal to Decimal (2 of 3)  Technique Multiply each bit by 16n, where n is the “weight” of the bit The weight is the position of the bit, starting from 0 on the right Add the results Note: 160 = 1, 161 = 16, 162 = 256 163 = 4096, Etc.
  • 27. 27 Hexadecimal to Decimal (3 of 3) ABC16 => C x 160 = 12 x 1 = 12 B x 161 = 11 x 16 = 176 A x 162 = 10 x 256 = 2560 274810
  • 28. 28 Decimal to Binary (1 of 3) Hexadecimal Decimal Octal Binary
  • 29. 29 Decimal to Binary (2 of 3)  Technique Divide by two, keep track of the remainder First remainder is bit 0 (LSB, least-significant bit) Second remainder is bit 1 Etc.
  • 30. 30 Decimal to Binary (3 of 3) 12510 = ?2 2 125 62 12 31 02 15 12 7 12 3 12 1 12 0 1 12510 = 11111012
  • 31. 31 Octal to Binary (1 of 3) Hexadecimal Decimal Octal Binary
  • 32. 32 Octal to Binary (2 of 3)  Technique Convert each octal digit to a 3-bit equivalent binary representation See Table, Slides 12-14
  • 33. 33 Octal to Binary (3 of 3) 7058 = ?2 7 0 5 111 000 101 7058 = 1110001012
  • 34. 34 Hexadecimal to Binary (1 of 3) Hexadecimal Decimal Octal Binary
  • 35. 35 Hexadecimal to Binary (2 of 3)  Technique Convert each hexadecimal digit to a 4-bit equivalent binary representation See Table, Slides 12-14
  • 36. 36 Hexadecimal to Binary (3 of 3) 10AF16 = ?2 1 0 A F 0001 0000 1010 1111 10AF16 = 00010000101011112
  • 37. 37 Decimal to Octal (1 of 3) Hexadecimal Decimal Octal Binary
  • 38. 38 Decimal to Octal (2 of 3)  Technique Divide by 8 Keep track of the remainder
  • 39. 39 Decimal to Octal (3 of 3) 123410 = ?8 8 1234 154 28 19 28 2 38 0 2 123410 = 23228
  • 40. 40 Decimal to Hexadecimal (1 of 3) Hexadecimal Decimal Octal Binary
  • 41. 41 Decimal to Hexadecimal (2 of 3)  Technique Divide by 16 Keep track of the remainder
  • 42. 42 Decimal to Hexadecimal (3 of 3) 123410 = ?16 123410 = 4D216 16 1234 77 216 4 13 = D16 0 4
  • 43. 43 Binary to Octal (1 of 3) Hexadecimal Decimal Octal Binary
  • 44. 44 Binary to Octal (2 of 3)  Technique Group bits in threes, starting on right Convert to octal digits See Table, Slides 12-14
  • 45. 45 Binary to Octal (3 of 3) 10110101112 = ?8 1 011 010 111 1 3 2 7 10110101112 = 13278
  • 46. 46 Binary to Hexadecimal (1 of 3) Hexadecimal Decimal Octal Binary
  • 47. 47 Binary to Hexadecimal (2 of 3)  Technique Group bits in fours, starting on right Convert to hexadecimal digits See Table, Slides 12-14
  • 48. 48 Binary to Hexadecimal (3 of 3) 10101110112 = ?16 10 1011 1011 2 B B 10101110112 = 2BB16
  • 49. 49 Octal to Hexadecimal (1 of 3) Hexadecimal Decimal Octal Binary
  • 50. 50 Octal to Hexadecimal (2 of 3)  Technique Use binary as an intermediary See Table, Slides 12-14
  • 51. 51 Octal to Hexadecimal (3 of 3) 10768 = ?16 1 0 7 6 001 000 111 110 2 3 E 10768 = 23E16
  • 52. 52 Hexadecimal to Octal (1 of 3) Hexadecimal Decimal Octal Binary
  • 53. 53 Hexadecimal to Octal (2 of 3)  Technique Use binary as an intermediary See Table, Slides 12-14
  • 54. 54 Hexadecimal to Octal (3 of 3) 1F0C16 = ?8 1 F 0 C 0001 1111 0000 1100 1 7 4 1 4 1F0C16 = 174148
  • 55. 55 Exercise – Convert ... Don’t use a calculator! Decimal Binary Octal Hexa- decimal 33 1110101 703 1AF Skip answer Answer
  • 56. 56 Exercise – Convert (answers) Decimal Binary Octal Hexa- decimal 33 100001 41 21 117 1110101 165 75 451 111000011 703 1C3 431 110101111 657 1AF
  • 57. 57 Common Powers (1 of 2)  Base 10 Power Preface Symbol 10-12 pico p 10-9 nano n 10-6 micro  10-3 milli m 103 kilo k 106 mega M 109 giga G 1012 tera T Value .000000000001 .000000001 .000001 .001 1000 1000000 1000000000 1000000000000
  • 58. 58 Common Powers (2 of 2)  Base 2 Power Preface Symbol 210 kilo k 220 mega M 230 Giga G Value 1024 1048576 1073741824 What is the value of “k”, “M”, and “G”? In computing, particularly w.r.t. memory, the base-2 interpretation generally applies
  • 59. 59 Example / 230 = 1. Double click on My Computer 2. Right click on C: 3. Click on Properties
  • 60. 60 Multiplying powers  For common bases, add powers 26  210 = 216 = 65,536 or… 26  210 = 64  210 = 64k ab  ac = ab+c
  • 61. 61 Table of powers Power Base 8 7 6 5 4 3 2 1 0 2 256 128 64 32 16 8 4 2 1 8 32,768 4,096 512 64 8 1 16 65,536 4,096 256 16 1
  • 62. 62 Fractions  Number point or radix point Decimal point in base 10 Binary point in base 2  No exact relationship between fractional numbers in different number bases Exact conversion may be impossible
  • 63. 63 Decimal fractions  Move the number point one place to the right Effect: multiplies the number by the base number Example: 139.010 139010  Move the number point one place to the left Effect: divides the number by the base number Example: 139.010 13.910
  • 64. 64 Fractions: Base 10 Place 10-1 10-2 10-3 10-4 Value 1/10 1/100 1/1000 1/10000 Evaluate 2 x 1/10 5 x 1/100 8 x 1/1000 9 x1/10000 Sum .2 .05 .008 .0009 .258910 10-1 10-2 10-3 10-4
  • 65. 65 Fractions: Base 2 .1010112 = 0.67187510 Place 2-1 2-2 2-3 2-4 2-5 2-6 Value 1/2 1/4 1/8 1/16 1/32 1/64 Evaluate 1 x 1/2 0 x 1/4 1x 1/8 0 x 1/16 1 x 1/32 1 x 1/64 Sum .5 0.125 0.03125 0.015625 2-1 2-2 2-3 2-4 2-5 2-6
  • 66. 66 Fractions: Base 10 and Base 2  No general relationship between fractions of types 1/10k and 1/2k Therefore a number representable in base 10 may not be representable in base 2 But: the converse is true: all fractions of the form 1/2k can be represented in base 10  Fractional conversions from one base to another are stopped If there is a rational solution, or When the desired accuracy is attained
  • 67. 67 Fractions: From Base B To Base 10  Determine the appropriate weight for each fractional digit as a negative power of the base  Multiply each digit by its weight  Add the values  Example: .A116 = 10x16-1 + 1x16-2 = 10x0.0625 + 1x0.00390625 = 0.6289062510
  • 68. 68 Fractions: From Base 10 To Base B  Multiply the fraction by the base value B (i.e., 2, 8 or 16)  Record the values that move to the left of the radix point and drop them  Repeat the process until the value being multiplied is zero, or the desired number of digits of accuracy is attained
  • 69. 69 Fractions: From Base 10 To Base B 0.67312510 = ?2 0.673125 x 2 1.346250 x 2 0.692500 x 2 1.385000 x 2 0.770000 x 2 0.1010112 1.540000 x 2 1.080000
  • 70. 70 Fractions: From Base 2 To Base 8, 16  Group digits from left to right in groups of 3 (base 8) or 4 (base 16)  Supplement the right-most group with 0’s, if necessary  Convert each group to the desired base. See Table, Slides 12-14
  • 71. 71 Fractions: From Base 8, 16 To Base 2  Convert each octal (base 8) or hexadecimal (base 16) digit to its 3- bit or 4-bit representation See Table, Slides 12-14
  • 72. 72 Fractions: between Base 8 and Base 16  Use binary conversion as an intermediary  Example: 0.C816 = ?8 1100 10002 6 2 0 0.C816 = 0.628
  • 73. 73 Mixed number conversion  Convert whole part and fraction part separately See Table, Slides 12-14
  • 74. 74 Arithmetic operations (1 of 14)  Binary Addition Two 1-bit values A B A + B 0 0 0 0 1 1 1 0 1 1 1 10 0 and carry 1 to the next more significant bit, i.e. “two”
  • 75. 75 Arithmetic operations (2 of 14)  Two n-bit values Add individual bits (see Table) Propagate carries 10101 21 + 11001 + 25 101110 46 11 Note: superscripts are carried amounts.
  • 76. 76 Addition (different bases) (3 of 14) Base Problem Largest Single Digit Decimal 6 +3 9 Octal 6 +1 7 Hexadecimal 6 +9 F Binary 1 +0 1
  • 77. 77 Addition (different bases) (4 of 14) Base Problem Carry Answer Decimal 6 +4 Carry the 10 10 Octal 6 +2 Carry the 8 10 Hexadecimal 6 +A Carry the 16 10 Binary 1 +1 Carry the 2 10
  • 78. 78 Addition Table: Base 10 (5 of 14) + 0 1 2 3 4 5 6 7 8 9 0 0 1 2 3 4 5 6 7 8 9 1 1 2 3 4 5 6 7 8 9 10 2 2 3 4 5 6 7 8 9 10 11 3 3 4 5 6 7 8 9 10 11 12 4 4 5 6 7 8 etc 9 10 11 12 13 310 + 610 = 910
  • 79. 79 Addition Table: Base 8 (6 of 14) + 0 1 2 3 4 5 6 7 0 0 1 2 3 4 5 6 7 1 1 2 3 4 5 6 7 10 2 2 3 4 5 6 7 10 11 3 3 4 5 6 7 10 11 12 4 4 5 6 7 10 11 12 13 5 5 6 7 10 11 12 13 14 6 6 7 10 11 12 13 14 15 7 7 10 11 12 13 14 15 16 38 + 68 = 118
  • 80. 80 Arithmetic operations (7 of 14)  Binary Subtraction Two 1-bit values A B A - B 0 0 0 0 1 1 1 0 1 1 1 0 and borrow 1 from the next more significant bit
  • 81. 81 Arithmetic operations (8 of 14)  Two n-bit values Subtract individual bits (see Table) Keep track of the borrowings 00100101 – 00010001 = 00010100 00100101 3710 - 00010001 - 1710 00010100 2010 0 10
  • 82. 82 Arithmetic operations (9 of 14)  Multiplication Decimal (just for fun) 35 x 105 175 000 35 3675
  • 83. 83 Arithmetic operations (10 of 14)  Binary multiplication, two 1-bit values A B A  B 0 0 0 0 1 0 1 0 0 1 1 1
  • 84. 84 Arithmetic operations (11 of 14)  Binary multiplication, two n-bit values As with decimal values 1110 x 1011 1110 1110 0000 1110 10011010
  • 85. 85 Multiplication Table: Base 10 (12 of 14) x 0 1 2 3 4 5 6 7 8 9 0 0 1 1 2 3 4 5 6 7 8 9 2 2 4 6 8 10 12 14 16 18 3 3 6 9 12 15 18 21 24 27 4 0 4 8 12 16 20 24 28 32 36 5 5 10 15 20 25 30 35 40 45 6 6 12 18 24 30 36 42 48 54 7 7 14 21 28 35 42 49 56 63 etc. 310 x 610 = 1810
  • 86. 86 Multiplication Table: Base 8 (13 of 14) x 0 1 2 3 4 5 6 7 0 0 1 1 2 3 4 5 6 7 2 2 4 6 10 12 14 16 3 0 3 6 11 14 17 22 25 4 4 10 14 20 24 30 34 5 5 12 17 24 31 36 43 6 6 14 22 30 36 44 52 7 7 16 25 34 43 52 61 38 x 68 = 228
  • 87. 87 Arithmetic operations (14 of 14)  Binary division, two n-bit values As with decimal values 100001/11 = 1011 11 ) 100001 1011 11 00100 11 11 11 0 divisor dividend quotient
  • 88. 88 Shifting a number  Shifting a decimal number to the left by one position is equivalent to multiplying by 10  Shifting a binary number to the left by one position is equivalent to multiplying by 2  General rule: shifting a number in any base left one digit multiplies its value by the base; shifting one digit right divides its value by the base
  • 89. 89 Thank you! Reading: Lecture slides and notes, Chapter 3