If you had to come up with a way to represent signed integers in 32-bits, how would you do it? One simple solution would be to use one bit to represent the sign, and the remaining 31 bits to represent the absolute value of the number. But as many intuitive solutions, this one is not very good. One problem is that adding and multiplying these integers would be somewhat tricky, because there are four cases to handle due to signs of the inputs. Another problem is that zero can be represented in two ways: as positive zero and as negative zero.
Read full article from Why computers represent signed integers using two’s complement
No comments:
Post a Comment