Number Representation
How do we represent signed (positive & negative) numbers?
Option 1: Sign and Magnitude
- Use left-most bit to represent the sign
- Use other bits to represent the magnitude
- Examples:
00000001
= +1
10000001
= -1 (sign & magnitude)
00000101
= +5
10000101
= -5 (sign & magnitude)
01111111
= +127
11111111
= -127 (sign & magnitude)
- Problem 1:
00000000
= +0
10000000
= -0 (sign & magnitude)
- Problem 2:
00000101
5
10000001
+ -1
--------
-----
10000110
-6 ???
Alyce Brady, Kalamazoo College