用补码运算方法求x+y=?,x-y=?,指出结果是否溢出.
问题描述:
用补码运算方法求x+y=?,x-y=?,指出结果是否溢出.
(1)x=0.1001 y=0.1100
(2)x=-0.0100 y=0.1001
答
(1)取补:[x]补=00.1001[y]补=00.1100 [-y]补=[[y]补]变补=11.0100
[x+y]补=[x]补+[y]补=01.0101符号位为01,结果正溢
[x-y]补=[x]补+[-y]补=11.1101x-y=[[x-y]补]补=11.0011=-0.0011
(2)取补:[x]补=11.1100[y]补=00.1001 [-y]补=[[y]补]变补=11.0111
[x+y]补=[x]补+[y]补=00.0101 x+y=[[x+y]补]补=0.0101
[x-y]补=[x]补+[-y]补=11.0011x-y=[[x-y]补]补=11.1101=-0.1101