Question

I am practising my addition of binarys and got to overflow i'm guessing, i need the answer to be 5 bit for the additions of 01010 and 11011, to save time thats decimal 10 and 27

When added I get 100101 which is the expected answer of 37.

However since the answer must be in 5 bit, does that mean i drop the bit on the left, the 1? I am confused about this because doesn't that make the answer 5? and not 37? since it would be 00101, or is this just how a computer does this?

Also can anyone shed light on what the two questions mean below?

What is the value of the carry in to the most significant bit?

What is the value of the carry out of the most significant bit?

Any help and clarification would be much appreciated.

Sim

Was it helpful?

Solution

If you only have five bit, then yes, the answer of 10+27 in binary is 5, because the maximum you can store in 5 bit is 2^5 - 1 = 31d = 11111b. Including the 0 you can store 32 distinct values in a 5 bit variable. So your result is 37mod32 = 5.

The most significant bit is the bit with the highest value, being the leftmost bit in your case. This bit, if 1, has the decimal value 16.

The "carry bit" is the bit, which is next to the MSB, not anymore in the variable itself. So to say the "sixth bit" in your five bit variable. It has the initial value 0:

0 01010
0 11011 +
---------
1 00101 =

But the resulting value 1. So you "carry out" a 1. This can be used by the computer, i.e., to detect such an overflow.

Let me know if you need more details on this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top