简体   繁体   English

将十进制数7710转化为8位二进制补码

[英]convert the decimal number 7710 into 8-bit binary two’s complement

I have a question about two's complement representation, the question says convert the decimal number 7710 into 8-bit binary two's complement:我有一个关于二进制补码表示的问题,问题是将十进制数 7710 转换为 8 位二进制二进制补码:

7710 divide by 2 = 3855 remainder 0
3855 divide by 2 = 1927 remainder 1
1927 divide by 2 = 963 remainder 1
963 divide by 2 = 481 remainder 1
481 divide by 2 = 240 remainder 1
240 divide by 2 = 120 remainder 0
120 divide by 2 = 60 remainder 0
60 divide by 2 = 30 remainder 0
30 divide by 2 = 15 remainder 0
15 divide by 2 = 7 remainder 1
7 divide by 2 = 3 remainder 1
3 divide by 2 = 1 remainder 1
1 divide by 2 = 0 remainder 1

7710 = 1111000011110

1111000011110 + 1 = 1111000011111

I've already found the value but my question is how to represent it in the form of 8-bit?我已经找到了这个值,但我的问题是如何以 8 位的形式表示它?

Thank you谢谢

You can't.你不能。 A 8-bit binary two's complement number can only represent number in the range [-128;127].一个8位的二进制补码数只能表示[-128;127]范围内的数。 7710 is not in this range so you can't represent it. 7710不在这个范围内,所以你不能代表它。
why -128?为什么是-128? because 100 0000 is the lowest number you can represent and that is -128 in decimal representation.因为 100 0000 是您可以表示的最小数字,十进制表示形式为 -128。
why 127?为什么是127? because 0111 1111 is the highest number you can represent and that is 127 in decimal representation.因为 0111 1111 是您可以表示的最高数字,十进制表示为 127。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM