3

我正在尝试学习二进制乘法,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)

我不知道如何继续。我什至不确定我是否完全正确。有人可以告诉我如何逐步做到这一点吗?我不想做任何其他方式。如果我这样做,大数字可能会很糟糕。谢谢

4

2 回答 2

4

你对 -10 的解释是错误的。

   ..11110110  (-10)
×    00000011    (3)
-------------
   ..11110110  (-10)
+ ..111101100  (-20)
-------------
   ..11100010  (-30)
于 2010-10-10T07:36:54.307 回答
0

希望这会帮助你。使用 2 的补码。溢出被丢弃。

2 的补码中的 -10 是 0110。在前面加上 1111 使其成为 8 位。

    11110110  (-10)
    00000011  (3)
  -----------
    11110110
   11110110
  -----------
  1011100010 (discard [10]) 

答案 = 11100010

换算回来是30。也就是说,11100010所代表的数字是-30。(2 的补偿)

于 2015-04-19T06:59:56.433 回答