This commit is contained in:
Miloslav Ciz 2024-11-23 23:30:27 +01:00
parent 5e0ba22bba
commit 9c911cc430
24 changed files with 1966 additions and 1860 deletions

View file

@ -1,6 +1,6 @@
# Two's Complement
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.
Two's complement is an elegant way of encoding signed (i.e. potentially negative) integer (and possibly also [fixed point](fixed_point.md)) [numbers](number.md) 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? Its most notable advantages are: