如何计算十进制数到8位多余的二进制数? [英] How do you calculate a decimal number to 8-bit excess binary?

查看:205
本文介绍了如何计算十进制数到8位多余的二进制数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我的电话号码是-17.我知道17的二进制表示形式是:00010001,您如何将其转换为8位多余的二进制?

For example I have the number -17. I know that the binary representation of 17 is: 00010001, how would you turn that into an 8-bit excess binary?

推荐答案

首先,您需要为多余的表示形式选择一个偏见.由于通常选择的偏差等于幅度的一半,因此对于8位,我们将选择-127作为偏差.

First of all you need to pick a bias for the excess representation. Since it's typical to select a bias equal to half the available range in magnitude, for 8 bits we 'll pick -127 as the bias.

这意味着您有8位将被解释为无符号整数,并且将从该整数中减去127以得到最终结果.因此,既然我们有

What this means is that you have 8 bits which will be interpreted as an unsigned integer and 127 will be subtracted from that integer to get the final result. Therefore, since we have

final = unsigned + bias
final = -17
bias  = -127

我们最终得到

unsigned = final - bias = -17 - (-127) = 110

因此,多余的127表示-17将为01101110(十进制110).

Therefore the excess-127 representation of -17 would be 01101110 (decimal 110).

这篇关于如何计算十进制数到8位多余的二进制数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆