what's the reason for adding "1"?

Thread Starter

PG1995

Joined Apr 15, 2011
832
Hi

Please check the attachment. You can find my question there. I understand that "1" should be added to get "-23" but what's the reason for this? Why did we end up "-24" in the first place rather than "-23"?

Thank you for your help.

Regards
PG
 

Attachments

steveb

Joined Jul 3, 2008
2,436
Hi

Please check the attachment. You can find my question there. I understand that "1" should be added to get "-23" but what's the reason for this? Why did we end up "-24" in the first place rather than "-23"?

Thank you for your help.

Regards
PG
That's just the nature of 1's complement numbers, the negative numbers are shifted by one if you determine the binary value by that method.

Take the example of zero. Positive zero is 0000 in 4 bit representation. Now take the 1's complement to get negative zero, and it is 1111. Now use the rule

The value is -2^3+2^2+2^1+2^0 = -8+4+2+1 =-1

Clearly the value is shifted down by one and you need to add one to get negative zero.

The shift by one shows up because the number zero is represented twice in this encoding method. 0000 and 1111 both represent zero because positive zero and negative zero are equal to each other.

As you know, 2's complement representation gets rid of the redundancy.
 

Papabravo

Joined Feb 24, 2006
21,225
It is precisely the end-around-carry that I mentioned in my previous post. A carry out of the MSD (Most Significant Digit) gets added back into the result.
 

Thread Starter

PG1995

Joined Apr 15, 2011
832
Thank you, Steve, Papabravo.

That's just the nature of 1's complement numbers, the negative numbers are shifted by one if you determine the binary value by that method.

Take the example of zero. Positive zero is 0000 in 4 bit representation. Now take the 1's complement to get negative zero, and it is 1111. Now use the rule

The value is -2^3+2^2+2^1+2^0 = -8+4+2+1 =-1

Clearly the value is shifted down by one and you need to add one to get negative zero.

The shift by one shows up because the number zero is represented twice in this encoding method. 0000 and 1111 both represent zero because positive zero and negative zero are equal to each other.

As you know, 2's complement representation gets rid of the redundancy.
Hi

Perhaps I might sound dumb but that's what I sound like in many of the threads! :)

Okay. Positive zero is 0000 and negative zero is 1111 in 4 bit number size. It might help you to understand my confusion if you have a look on this thread here. Referring again to the attachment in my first post above. "1" wasn't added to the result when the final answer was a positive number. But it was when answer was negative. Could you please elaborate a little on this? Thanks.

Best wishes
PG
 
Top