Content deleted Content added
Guy Harris (talk | contribs) Link bitwise NOT. |
streamlined opening paragraph, improved the logic |
||
Line 1:
{{Short description|Mathematical operation on binary numbers, and a number representation based on this operation}}
'''Two's complement''' is the most common [[signed number representations|method of representing signed]] (positive, negative, and zero) [[Integer (computer science)|integers]] on computers,<ref>E.g. "Signed integers are two's complement binary values that can be used to represent both positive and negative integer values", Section 4.2.1 in ''Intel 64 and IA-32 Architectures Software Developer's Manual'', Volume 1: Basic Architecture, November 2006</ref> and more generally, [[Fixed-point arithmetic|fixed point binary]] values.
Unlike the [[ones' complement]] scheme, the two's complement scheme has only one representation for zero, with room for one extra negative number (the range of a 4-bit number is -8 to +7). Furthermore, the same arithmetic implementations can be used on signed as well as unsigned integers<ref>
{{cite book
|first1=Alexandre |last1=Bergel
Line 15:
}}
</ref>
and differ only in the integer overflow situations, since the sum of representations of a positive number and its negative is 0 (with the carry bit set).
== Procedure ==
|