Update
This commit is contained in:
parent
616f5729ec
commit
365d04122d
13 changed files with 30 additions and 21 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
Two's complement is an elegant way of encoding signed (i.e. potentially negative) integer (and possibly also [fixed point](fixed_point.md)) numbers in [binary](binary.md). It is one of the most basic concepts to know as a programmer; for its simplicity and nice properties two's complement is the way that's used to represent binary integers almost everywhere nowadays. Other ways of encoding singed numbers, mainly [sign-magnitude](sign_magnitude.md) and [one's complement](ones_complement.md), are basically always inferior.
|
||||
|
||||
Why is two's complement so great? It's most notable advantages are:
|
||||
Why is two's complement so great? Its most notable advantages are:
|
||||
|
||||
- **There if only one [zero](zero.md) value** (while other encodings such as sign-magnitude and one's complement have positive and negative zero which wastes values and complicates algorithms).
|
||||
- **Highest bit indicates the number sign** in the same way as e.g. in sign-magnitude and one's complement representations, i.e. determining whether a number is positive or negative is just as easy as in the more naive representations.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue