2.3 Integer Arithmetic Flashcards

1
Q

In unsigned addition, what does the compiler do if the sum overflows

A

subtract 2^w

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

unsigned negation formula

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Main thing to remember in multiplication

A

if the result is out of the range, truncate to the number of bits needed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly