二进制乘法、2 的补码

发布于 2024-09-26 19:30:43 字数 696 浏览 5 评论 0原文

我正在尝试学习二进制乘法,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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浮云落日 2024-10-03 19:30:43

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

   ..11110110  (-10)
×    00000011    (3)
-------------
   ..11110110  (-10)
+ ..111101100  (-20)
-------------
   ..11100010  (-30)

Your interpretation of -10 is off.

   ..11110110  (-10)
×    00000011    (3)
-------------
   ..11110110  (-10)
+ ..111101100  (-20)
-------------
   ..11100010  (-30)
玩心态 2024-10-03 19:30:43

希望这会对您有所帮助。使用 2 的补码。溢出被丢弃。

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

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

答案 = 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.

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

answer = 11100010

when converted back, it's 30. that means the number represented by,11100010 is -30. (2's comp.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文