Module 2 Part II - Codes PDF
Module 2 Part II - Codes PDF
GE 112
Mathematics in the Modern World
Ricky F. Rulete
Faculty, Math & Stat Department
College of Arts & Sciences
University of Southeastern Philippines
Outline
This module contains the following:
1. Introduction
2. Number Systems
Decimal and Binary Numbers
Arithmetic Operations
Binary Codes
3. Integers and Computers
4. Logic and Computer Addition
5. Module Exercises
6. References
Outline Page 2
Introduction
Digital computers are devices capable of solving
problems by processing information in discrete form.
Introduction Page 3
Introduction
Introduction Page 4
Introduction
We must represent the decimal digits by a code that
contains 1s and 0s since computer can accept only
binary values.
Introduction Page 5
Number Systems
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.
a number 𝑁𝑟 with 𝑛 digits to the left of the
decimal point and 𝑚 digits to the right of the
decimal point in base 𝑟 contains 𝑟 digits
0,1,2, … , 𝑟 − 1, and is expressed as a power
series in 𝑟 with the general form
𝑛−1 −𝑚
𝑁𝑟 = 𝐴𝑖 𝑟 𝑖 + 𝐴𝑖 𝑟 𝑖
𝑖=0 𝑖=−1
where 𝐴𝑖 ∈ 0,1,2, … , 𝑟 − 1
1 Number Systems Page 6
Number Systems
𝑟 is called the base or radix, the “.” is called the
radix point, 𝐴𝑛−1 is referred to as the most
significant digit (msd) and 𝐴−𝑚 as the least
significant digit (lsd) of the number
When the number is expressed in positional
notation, only the coefficients and the radix point
are written down:
𝐴𝑛−1 𝐴𝑛−2 … 𝐴1 𝐴0 . 𝐴−1 𝐴−2 … 𝐴−𝑚+1 𝐴−𝑚
324.15 = 3 × 52 + 2 × 51 + 4 × 50 + 1 × 5−1
= 75 + 10 + 4 + 0.2 = 89.210
𝐴2 = 3 is the msd and A−1 = 1 is the lsd of 324.15 ,
while 𝐴1 = 8 is the msd and A−1 = 2 is the lsd of
89.210
1 Number Systems Page 9
Binary Numbers
𝑟 = 2, 𝐴𝑖 ∈ {0,1}
A binary number is expressed with a string of 1s and
0s and, possibly, a binary point
the binary system is used internally by all modern
computers
Normally we count from left to right,
1 2 3 4 etc.
In Binary we count in the opposite direction
8421
It’s important to remember this in order to
convert your numbers.
For instance
11012 = 1 × 23 + 1 × 22 + 0 × 21 + 1 × 20 = 1310
𝒏 𝟐𝒏 𝒏 𝟐𝒏 𝒏 𝟐𝒏
0 1 8 256 -1 0.5
1 2 9 512 -2 0.25
2 4 10 1,024 -3 0.125
3 8 11 2,048 -4 0.0625
4 16 12 4,096 -5 0.03125
5 32 13 8,192 -6 0.015625
6 64 14 16,384 -7 0.0078125
7 128 15 32,768 -8 0.00390625
62510 = 29 + 26 + 25 + 24 + 20 = 10011100012
Example 5.
Example 6.
Example 7.
Borrows: 00110
Minuend: 10011 11110
Subtrahend: −11110 − 10011
Difference: −01011
Example 8.
Multiplicand: 1011
Multiplier: × 101
1011
0000
1011
Product: 110111
Note: 10112 = 1110 , 1012 = 510 , 1101112 = 5510
Example 9.
10001
11001 110110110 17
11001 25 438
00100 25
00000 188
01001 175
00000 13
10011
00000
remainder
100110
11001
1101
A B Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
U 1001101
S 1000001
1010100
e
1001000
P 1000101
8510
101101
01110011
10110011
10010110
Unsigned 2’s
Decimal Sign-Magnitude 1’s Complement
integer Complement
−5110
00101100
10110011
11001101
References Page 68