https://en.wikipedia.org/wiki/Two‘s_complement
The two‘s-complement system has the advantage that the fundamental arithmetic operations of addition, subtraction, and multiplication are identical to those for unsigned binary numbers (as long as the inputs are represented in the same number of bits and any overflow beyond those bits is discarded from the result). This property makes the system both simpler to implement and capable of easily handling higher precision arithmetic. Also, zero has only a single representation, eliminating the subtleties associated with negative zero, which exists in ones‘-complement systems.
Two's complement
时间: 2024-10-11 07:26:15