简体   繁体   English

151作为8位有符号二进制数

[英]151 as an 8-bit signed binary number

Converting base 10 to base 2 n = 8 将基数10转换为基数2 n = 8

A= 49 B= 151 A = 49 B = 151

By doing so 49 is 00110001 and -49 would be 11001111. 这样做49是00110001,-49将是11001111。

I am having problems with finding 151 and -151 because after the conversion it is already an 8-bit number. 我在查找151和-151时遇到问题,因为转换后它已经是8位数字。 151 is 10010111, but in signed binary doesn't the farthest left digit indicate whether its negative or positive. 151是10010111,但是在带符号的二进制数中,最左边的数字并不表示其为负数还是正数。 1 is negative and I am trying to get positive 151, but within 8-bits. 1为负数,我试图得到正151,但在8位以内。 How would I go about this? 我将如何处理?

如果只有8位,则您的无符号范围是0到255,这使您的有符号范围为-128到127。因此,仅8位不能将-151或151表示为有符号数。

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

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