I need to know the minimum numbers of bits needed to represent 130 and -130 in 8086.
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. The bit pattern for 130 is
1000 0010
After placing an infinite number of 0's on the left it's
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
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. So the shortest two's complement representation of -130 requires 9 bits.
1 0111 1110
If the question is what size register is needed on an x86 processor, then the answer is a 16-bit register.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.