二进制乘法、2 的补码
我正在尝试学习二进制乘法,2 的补负数。
-10
x 3
我知道有一个简单的方法可以做到这一点。就像符号扩展和初始部分积一样。
-10 0110 twos complement
x 3 x 0011
---- ------
000000 (initial partial product) with sign extension at the MSB
10110 (bit 0 of the 3 times 10, sign extended at MSB)
110110 (sign extended sum of initial partial product and
Multiplicand)
10110- (bit 1 of the 3 multiplied by the 10. sign extension at the MSB Note the
Multiplicand is shifted left by one bit)
我不知道如何继续。我什至不确定到目前为止我是否完全正确。有人可以告诉我如何按步骤进行吗?我不想以任何其他方式做这件事。如果我按照传统方式去做,大数字可能会很糟糕。谢谢
I am trying to learn Binary Multiplication, 2's complement negative numbers.
-10
x 3
I know there is a simple way of doing this. Like sign extension and initial partial product.
-10 0110 twos complement
x 3 x 0011
---- ------
000000 (initial partial product) with sign extension at the MSB
10110 (bit 0 of the 3 times 10, sign extended at MSB)
110110 (sign extended sum of initial partial product and
Multiplicand)
10110- (bit 1 of the 3 multiplied by the 10. sign extension at the MSB Note the
Multiplicand is shifted left by one bit)
I am lost on how to continue. I am not even sure if i was completely right up to this point. Can someone show me how to do it by steps? I dont want to do it any other way. If i do it the traditional way big numbers could be bad. Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你对-10的解释是错误的。
Your interpretation of -10 is off.
希望这会对您有所帮助。使用 2 的补码。溢出被丢弃。
-10的2的补码是0110。在前面加上1111,使其成为8位。
答案 = 11100010
换算回来是30。也就是说,11100010 代表的数字是-30。 (2的比较)
Hope This will help you. Use 2's complement. Overflows are discarded.
-10 in 2's complement is 0110. Add 1111 in front to make it 8 bits.
answer = 11100010
when converted back, it's 30. that means the number represented by,11100010 is -30. (2's comp.)