Number Representation
How do we represent signed (positive & negative) numbers?
Option 2: One's Complement
- Flip every bit to represent the number's negative value
(Note: this works both ways!)
- Left-most bit still represents the sign
- Examples:
00000001
= +1
11111110
= -1 (one's complement)
00000101
= +5
11111010
= -5 (one's complement)
01111111
= +127
10000000
= -127 (one's complement)
- Problem 1:
00000000
= +0
11111111
= -0 (one's complement)
- Problem 2:
00000101
5
11111110
+ -1
--------
-----
100000011
overflow ???
Alyce Brady, Kalamazoo College