Question

Suppose you have 3 N-bit unsigned integers: a, b, and c. What is the minimum number...

Suppose you have 3 N-bit unsigned integers: a, b, and c. What is the minimum number of bits required to present: (a*b)+c in order not to get an overflow? Explain how you reached your answer.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Suppose you have 2 N-bit unsigned integers: a, b, c.

To find: Minimum number of bits required to present (a*b)+c, and no overflow should occur.

first perform a*b, here both numbers are N-bit long.

Maximum number of bits required to store multiplication of 2 n-bit numbers = n+n = 2n

Then add c ie (c*b)+c:

Here is the tricky part,

Maximum number that can be represented using N-bits = 2N - 1

Maximum number in decimal that can be obtained by multipliying 2 N-bit numbers = ( 2N-1 ) * ( 2N-1 ) =

=> 22N - 2N - 2N +1 = 22N - 2N+1 +1

Maximum number that can be represented using 2N bits = 22N -1 ....1

When we add another N-bit number in multiplication of 2 N-bit numbers,

Maximum number in decimal of (a*b)+c , all N-bit = 22N - 2N+1 +1 + 2N - 1 = 22N - 2N

Which is less than what we can represent using 2N bits, see eq ...1

So minimum number of bits required to store (a*b)+c without getting overflow = 2N

Add a comment
Know the answer?
Add Answer to:
Suppose you have 3 N-bit unsigned integers: a, b, and c. What is the minimum number...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT