对于 32 位整数来说,二进制 100...(31 个零)的值是多少?
这只是一个随机的想法。 100...(31 个零)的二进制补码也是 100... 所以,该值必须是 0。但是我们知道 0 的二进制表示形式是 000...
我知道它不能是 -0 和 +0,因为每个二进制表示形式都应该映射到唯一的值。
It's just a random thought.
The two's complement of 100...(31 zeros) is also 100...
So, the value must be 0. But we know that the binary representation of 0 is 000...
I know it can't be a -0 and a +0 because every binary representation should map to a unique value.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是 −231。二进制补码只有一个零,负数范围比正数多扩展一个数。是的,这意味着有一个负数没有等价的正数 - 这有时被称为
It's −231. Two's complement has only a single zero and the negative range extends one number further than the positive. And yes, that means that there is a single negative number that has no positive equivalent – this is sometimes called the »weird number« since it is an exception of how two's complement numbers are built.
它是最小的可能值:−231。它不是零,因为 100... 不是零。现在是 231。
It's the smallest possible value: −231. It's not zero, because 100... is not zero. It's 231.