📜  有符号幅度和 2 的补码之间的差异

📅  最后修改于: 2021-09-16 10:38:57             🧑  作者: Mango

1. 签名幅度法:
在有符号幅度方法中,数字分为两部分:符号位和幅度。符号位为 1 表示负数,0 表示正数。数字的大小用数字的二进制形式表示。
示例:让我们以 8 位寄存器为例。

2. 2的补码方法:
在 2 的补码方法中,正数的表示方式与它们在符号幅度方法中的表示方式相同。但如果数字为负数,则先用正号表示该数字,然后取该数字的 2 的补码。
示例:让我们以 8 位寄存器为例。

Signed Magnitude 和 2’s Complement Method 的区别:

SIGNED MAGNITUDE METHOD 2’s COMPLEMENT METHOD
It is a method to denote fixed point signed numbers. It is also used to denote fixed point signed numbers.
Number is divided into two parts. Number is considered as a whole.
Sign bit is considered explicitly. Sign bit is not considered explicitly.
Additional hardware is required for resultant sign of arithmetic. No additional hardware is required in 2’s complement method.
Addition and subtraction are performed on separate hardware. Addition and subtraction are performed by using adder only.
It has two different representation for 0. One is +0 and second is -0. (+0 : 0000 0000) & (-0 : 1000 0000) 0 has only one representation for -0 and +0 (+0 or -0 : 0000 0000).
It is non-weighted system. It assigns negative weight to the sign bit.