我们假设使用 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 ,形成 no 的 2 补码。Y并将其添加到 X。
假设我们必须减去两个否。(-7)和(-5),那么根据规则,我们需要找到(-5)的2的补码,然后将其添加到(-7)。
图书解决方案:
我需要知道,-5 的 2 的补码是 0101。