【发布时间】:2013-05-10 20:29:07
【问题描述】:
我们假设使用 4bit 2 的补码系统来表示正数和负数
Suppose we have to find 2's complement of no. 3
We can subtract this no. with 2^4
that is ,
= 2^4 - 3
= 13
=1101 (which represent -3 , in 2's complement system)
//* there is another way of finding 2's complement , taking 1's complemen of the
number and add 1 to it.
在书中给出的规则是减去两个没有。
规则: 减去两个 no X 和 Y ,即 X - Y ,形成 2 的 no 补码。 Y 并将其添加到 X。
假设我们必须减去两个不。 (-7)和(-5),那么根据规则,我们需要找到第(-5)的2的补码,然后将其添加到(-7)中。
预订解决方案:
我需要知道,-5 的 2 的补码是 0101。
【问题讨论】:
标签: math programming-languages numbers computer-science