Professional Documents
Culture Documents
CH 1 Number Systems and Conversions - 3 NR
CH 1 Number Systems and Conversions - 3 NR
CH 1 Number Systems and Conversions - 3 NR
EE & IT AU
Hasan Zidan
1
One’s Complement Representation
One’s complement is another way to represent signed integers.
2
One’s Complement Examples
-5 = 1111 1010
+5 = 0000 0101
+127 = 0111 1111
-127 = 1000 0000
+0 = 0000 0000
-0 = 1111 1111
-(2N – 1) to + (2N – 1)
3
One’s Complement (cont.)
n-1
1. Addition of two positive no’s., sum < 2 (n=8)
+25 0001 1001
+
+14 0000 1110 Correct answer
+39 0010 0111
n-1
2. Addition of two positive no’s., sum >= 2
+125 0111 1101
+
+ 14 0000 1110 Wrong answer (-) overflow
-116 1000 1011
3. Addition of +ve < –ve in magnitude
+25 0001 1001
+ Correct answer
- 40 1101 0111
-15 1111 0000 4
4. Addition of +ve > –ve in magnitude
+ - 25 1110 0110
Correct answer no overflow
+ 40 0010 1000
+ 15 (1) 0000 1110
1 End-around carry
0000 1111
n-1
5. Addition of two -ve no’s., |sum| < 2
- 25 1110 0110
+
- 14 1111 0001 Correct answer no overflow
- 39 (1) 1101 0111
1
1101 1000
n-1
6. Addition of two negative no’s., |sum| >= 2
-125 1000 0010
+ 1111 0001
- 14 Wrong answer (+) overflow
- 139 (1) 0111 0011
1
0111 0100
One’s Complement Comments
-5 + 5 = -0 (Problem No. 2)
6
Two’s Complement Representation
11
What do you need to know?
12