补码加减法:X=+1000100,Y=+1110,求X+Y,X-Y的值
问题描述:
补码加减法:X=+1000100,Y=+1110,求X+Y,X-Y的值
还有两数相加减是如何算的,有什么规律么?
答
补码加减法:X=+1000100,Y=+1110,求X+Y,X-Y的值
若是16位二进制数.
则:(X)原码=0000000001000100
(Y)原码=0000000000001110
(Y)反码=1111111111110001
(Y)补码=1111111111110010
X+Y=(X)原码+(Y)原码
=0000000001000100+0000000000001110
=0000000001010010
X-Y=(X)原码+(Y)补码
=0000000001000100+1111111111110010
=0000000000110110