[英]Minimum no of bits to represent -130 in 8086?
I need to know the minimum numbers of bits needed to represent 130 and -130 in 8086. 我需要知道表示8086中的130和-130所需的最小位数。
If somebody knows the answer for sure, please let me know. 如果有人肯定知道答案,请告诉我。
When taking the two's complement of a number, you must 在取数字的二的补码时,您必须
Let's apply this to the number -130. 让我们将其应用于数字-130。 The bit pattern for 130 is
130的位模式是
1000 0010
After placing an infinite number of 0's on the left it's 在左侧放置无穷多个0之后
0000 0000 1000 0010
OK, so eight is slightly less than infinity, but you get the idea. 好的,所以八比无穷大一点,但是你明白了。 Next invert to get
下一个反转得到
1111 1111 0111 1101
and add 1 to get 并加1得到
1111 1111 0111 1110
At this point you can remove some of the infinite 1's on the left, but you must keep at least one of them. 此时,您可以删除左侧的一些无限1,但必须至少保留其中一个。 So the shortest two's complement representation of -130 requires 9 bits.
因此,最短的二进制补码表示法-130需要9位。
1 0111 1110
If the question is what size register is needed on an x86 processor, then the answer is a 16-bit register. 如果问题是x86处理器上需要什么大小的寄存器,则答案是16位寄存器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.