如何知道如果一个二进制数重新presents负数? [英] how to know if a binary number represents a negative number?
问题描述
我读了一些C文本。在正值和负值会议中,笔者提到的重$ P $的几种方法以二进制形式psenting负数。
I am reading some C text. In the Negative and Positive Values session, the author mentioned several ways of representing a negative number in binary form.
我明白所有的方式,想知道是否有给二进制数,我们可以判断它是否是负的?
I understood all of the way and was wondering if with a give binary number, can we determine if it is negative?
例如,在-92具有二进制形式:10100100.但是,如果我们给出10100100,我们可以说是-92,而不是其他的非负数
For example, the -92 has the binary form: 10100100. But if we are given 10100100, can we say that is -92, and not other non-negative number?
推荐答案
这取决于重新presentation,当然。在补,这被广泛使用,你只需看看最显著位。
It depends on the representation, of course. In two's complement, which is widely used, you simply look at the most significant bit.
这篇关于如何知道如果一个二进制数重新presents负数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!