Lecture 05 - Calculations With Binary Numbers
Lecture 05 - Calculations With Binary Numbers
Numbers
Binary Addition 2
A B A+ B
0 0 0
0 1 1
1 0 1
1 1 10
“two”
Binary Addition 3
Propagate carries
For example
1 1
10101 21
+ 11001 + 25
101110 46
Binary Addition - Practice 4
1. 101 + 11 =
2. 111 + 111 =
3. 1010 + 1010 =
4. 11101 + 1010 =
5. 11111 + 11111 =
Binary Multiplication 5
A B AB
0 0 0
0 1 0
1 0 0
1 1 1
Binary Multiplication 6
E.g., 1110
x 1011
1110
1110
0000
1110
10011010
Binary Multiplication - Practice 7
1002 x 0102 =
1112 x 0102 =
1102 x 0112 =
1012 x 0112 =
11102 x 00112 =
11012 x 01012 =
00102 x 11012 =
10102 x 11012 =
Signed Numbers 8
sign-magnitude representation
the twos-complement representation
Sign-Magnitude Representation 9
In this representation, the leftmost bit of a binary code
represents the sign of the value:
0 for positive
1 for negative
Begin with the binary representation of the positive value, then flip
the leftmost zero bit
Sign-Magnitude Representation 11
100011012
Google class room 15
Two's complement allows negative and
positive numbers to be added together without
any special logic.
http://www.wikihow.com/Add-Binary-Numbers