I appreciate for your videos. You took an example about the problem of positive and negative zero, "by supposing negative zero, -1+1= - 0 and then - 0+1=0!!!". Even by binary addition, we can't get such a result that negative zero plus one is equal to zero. In binary addition, it would be -1 (1 0 0 0 0 0 0 1). Could you please clarify your example? And also, while the result of the both columns which you mentioned, is the same (positive one), why asking the computer for zero twice is a problem?
In general, it's a matter of realization that if we use the 8th bit as a sign bit, we have two zeros (10000000 & 00000000). So, if we simply count in either direction, we're going to end up in zero twice (with different binary representation). Why is this a problem? The hardware checks if two values are equal by comparing all the bits. If one bit is different, then they are not equal. Hence, -0 and 0 wouldn't be equal. They could modify the hardware to allow this, but modifying the software is simpler. If one mathematical result yields -0 and the other yields 0, it would result in those two results not being equal.
Awesome video! First time I've actually understood the reason for 2's compliment!
I appreciate for your videos.
You took an example about the problem of positive and negative zero, "by supposing negative zero, -1+1= - 0 and then - 0+1=0!!!".
Even by binary addition, we can't get such a result that negative zero plus one is equal to zero. In binary addition, it would be -1 (1 0 0 0 0 0 0 1).
Could you please clarify your example?
And also, while the result of the both columns which you mentioned, is the same (positive one), why asking the computer for zero twice is a problem?
Thanks for your answer in advance.
In general, it's a matter of realization that if we use the 8th bit as a sign bit, we have two zeros (10000000 & 00000000). So, if we simply count in either direction, we're going to end up in zero twice (with different binary representation). Why is this a problem? The hardware checks if two values are equal by comparing all the bits. If one bit is different, then they are not equal. Hence, -0 and 0 wouldn't be equal. They could modify the hardware to allow this, but modifying the software is simpler. If one mathematical result yields -0 and the other yields 0, it would result in those two results not being equal.
@@VelcodeCS I got the point. I'm so grateful for your reply.