*This preview shows
page 1. Sign up
to
view the full content.*

**Unformatted text preview: **atch?v=GcDshWmhF4A Binary Subtraction
Decimal Subtraction Binary Subtraction 8423 6915
1101011 1001101
..wait.. What about 1001101 – 1101011?
How do we represent negative numbers? Properties of a Properties of a Good Representation Should be simple Allows us to do useful things Should be efficient Recovering from errors should be possible Negative Numbers
Negative Numbers How would we represent 5 in binary? Signmagnitude: use an extra bit for +/ + 5 = (+) 101 = 0101
5 = () 101 = 1101 (this assumes we have a fixed (known) word size so that we know the first bit represents +/, and not the next power of 2) What about 0? – different 0’s can cause problems Negative Numbers
Negative Numbers Signmagnitude (use one bit for sign) is perfectly acceptable, with minor inconvenience, but is not as good as a clever alternative. “Two’s complement notation” is used. –
–
– only one representation of 0
allows computation of subtraction via addition
a bit confusing on first sight. Towards understanding two’s complement: Towards understanding two Using 1 digit Suppose we had the symbols 0 through 9. How many (positive and negative) numbers can we represent? Which symbol gets which number? 10’s complement
10
0 1
2
3 9
8 0 1
1 7
4 3
5
5 4 2 2 repr...

View
Full
Document