2.3 Integer Arithmetic Flashcards
1
Q
In unsigned addition, what does the compiler do if the sum overflows
A
subtract 2^w
2
Q
In unsigned addition, what is the range for the sum?
(When is the sum defined as overflow)
A
Less than 2^w or greater than 2^(w+1)
3
Q
unsigned negation formula
A
4
Q
In two’s-complement addition, what does the compiler do if the sum overflows
A
positive overflow: subtract 2^w
negative overflow: add 2^w
5
Q
Main thing to remember in multiplication
A
if the result is out of the range, truncate to the number of bits needed