문제

It seems like one's complement representation of signed numbers is the most popular now (and probably the only representation used in the modern hardware). Why is it exactly better than others?

도움이 되었습니까?

해결책

Actually the dominant representation is two's complement.
Representation methods include:
- signed magnitude
- one's complement
- two's complement
One's complement replaced signed magnitude because the circuitry to implement it was much simpler.
One's complement has 2 representations for zero which complicates programming since it needs to test for -0 and +0.
This problem is not present in two's complement (has one value for 0) which is the dominant representation used universally today.

다른 팁

This question starts with a false premise. Two's complement is superior and common. This is because it doesn't have two representations of zero and and the hardware is simpler because the circuity doesn't need to check the sign before performing addition and subtraction.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top