You are on page 1of 21

CSCM1101: Fundamentals of Computing and Information Systems

ITIS101: Fundamentals of Information Technology


Semester 1 : 2022/2023

03
Chapter 3 - Understanding Data Your Text Here
You can simply im-
press your audience
3.2- Binary Arithmetic and Conversions and add a unique
zing.
04 05 06
Your Text Here Your Text Here
You can simply im- You can simply im-
press your audience press your audience
and add a unique and add a unique
zing. zing.
Chapter 1 Topics
1 Number Systems
1.1: Understand the different representations of number systems
02
1.2: Convert a number system to any other number system
03

Binary Arithmetic and Conversions


2 2.1: Understand how to get the 1’s and 2’s complement of a number.
2.2: Perform binary Arithmetic (addition and subtraction)
05 06
Your Text Here Your Text Here
You can simply im- You can simply im-
Logic Design press your audience press your audience
Explain the different logic gates (AND,
add aOR, NOT, NAND,and
NOR,
addXOR and XNOR)
3 and
Write the expression from a given
zing.logic
unique
circuit zing.
a unique

Draw truth table and logic circuits from an expression


Design logic circuits from a given expression using Logisim
COMPLEMENTS
Complements are used in
digital computers for simplifying
In computers, numbers are
the subtraction operation and
represented in binary
for logical manipulation.
forms.

As the binary system has


base r = 2. So the two types
of complements for the
binary system. These are:
 r’s complement
The arithmetic operations (2's complement )
performed by computers  (r-1)’s complement
therefore involves binary (1's complement)
numbers.
1’s Complement
1’s Complement (ex)
1’s Complement (exe)

10101 = ?
2’s Complement
2’s Complement (ex)
2’s Complement (exe)

10101 = ?
Binary Arithmetic -Addition

Rules
Binary Arithmetic –Addition (ex)
Binary Arithmetic –Addition (exe)

1101 + 1011 = ?

1 1 1
1101 + 13 +
1011 11
----------- -----------
11000 24
Binary Arithmetic –Addition (exe)

1101 + 1111 = ?

13
15
-----------
28
Binary Arithmetic - Subtraction

Rules
Binary Arithmetic – Subtraction (ex)
Ex1. Ex2.
Binary Arithmetic – Subtraction (exe)

110 – 101 = ?
Binary Subtraction using 1’s Complements
(X)2 – (Y) 2 = (?) 2

Steps:
1- Find the 1’s complement of (Y) (subtrahend) (change 1 to 0 & 0 to 1)
2- Add (X) (minuend) to the result of step 1 (i.e., to the 1’s complement of Y)
3- If there is a carry, add it to the LSD of the sum. (this will be the result)
3- If there is NO carry, take the 1’s complement of the sum and assign nega-
tive(-) sign to the answer ( this will be the result)
Binary Subtraction using 1’s Complements
Case-1: with carry Case-2: no carry
58 43 15 38 49 -11
(111010)2 – (101011) 2 = (?)
1111
2 2 (100110)2 – (110001) 2 = (?)
- 1011 2
2

Step-1 1010112 Step-1 1100012


010100 2 1’s complement 001110 2 1’s complement
Step-2 1110102 Step-2 1001102
0101002 + 0011102 +
----------- -----------
1001110 2 110100 2
Step-3 001110 Step-3 110100 2
1 + (-) 0010112
-----------
001111 2
Binary Subtraction using 2’s Complements
(X)2 – (Y) 2 = (?) 2

Steps:
1- Find the 2’s complement of (Y) (subtrahend) (change 1 to 0 & 0 to 1 then add 1)
2- Add (X) (minuend) to the result of step 1 (i.e., to the 2’s complement of Y)
3- If there is a carry, discard the carry. (the remaining will be the result)(Positive)
3- If there is NO carry, take the 2’s complement of the sum and assign negative (-)
sign to the answer ( this will be the result) (Negative)
Binary Subtraction using 2’s Complements
Case-2: no carry
Case-1: with carry (1000)2 – (1101) 2 = (?)
- 101
2 2
(1111)2 – (1001) 2 = (?)
1102 2
Step-1 11012
Step-1 10012 0010 2 1’s complement

0110 2 1’s complement 1+


-----------
1 +
0011 2’s complement
-----------
Step-2 10002
0111 2’s complement
+
00112
Step-2 11112
-----------
01112 + 10112 No carry !!
----------- Step-3 10112
10110 2 There is a carry !!
0100 2 1’s complement
Step-3 10110 discard the carry 1+
-----------
(-) 0101 2’s complement
Examples of Binary Subtraction using 2’s Complements
Case-2: no carry
Case-1: with carry (10100)2 – (11011) 2 = (?)
- 111
2 2
(101110)2 – (001110) 2 = (?)
100000
2 2
Step-1 110112
Step-1 0011102 00100 2 1’s complement
110001 2 1’s complement 1 +
-----------
1 +
00101 2’s complement
-----------
Step-2 101002
110010 2’s complement
001012+
Step-2 1011102
-----------
1100102 + 110012 No carry !!
----------- Step-3 110012
1100000 2 There is a carry !!
00110 2 1’s complement
1 +
Step-3 1100000 discard the carry -----------
(-) 00111 2’s complement

You might also like