RU beehive logo ITEC dept promo banner
ITEC 122
2008fall
ibarland

homeinfolecturesexamsarchive

lect11a
implementing ints
two's complement

Fixed-point arith:
- to motivate, compare 5-bit vs 3-decimal-digit
- unsigned range:
- signed range:
Two problems w/ sign: 
 - +/-0; 
 - addition of negatives means doing a separate subtraction algorithm.
   (What happens if we did try 
  examples:  57+-30; 57+-80; 4+-2; 4+-10

Try 2's complement:
  invert every bit; then add 1
  4+-2    4+-10
Why?  Compare to 10's complement:
  57+-30; 57+-80
  Hey, 10's complement of (-n) is 1000-n.
   57+(1000-30); 57+(1000-80)

homeinfolecturesexamsarchive


©2008, Ian Barland, Radford University
Last modified 2008.Dec.08 (Mon)
Please mail any suggestions
(incl. typos, broken links)
to iba�rlandrad�ford.edu
Powered by PLT Scheme