two's complement

noun — 2 senses

two's complement

noun
1

Computing, Engineering, Mathematics, Natural sciences, Physical sciences, Sciences The number obtained by complementing every bit of a given number and adding one. A number and its complement add to 2ⁿ, where n is the word size of the machine.

  • The two's complement of 0xAAAA is 0x5556 on a 16-bit machine, and 0xFFFF5556 on a 32-bit machine.
2

Computing, Engineering, Mathematics, Natural sciences, Physical sciences, Sciences The convention by which bit patterns with high bit 0 represent positive numbers from 0 to 2ⁿ⁻¹-1 directly, while bit patterns with high bit 1 represent negative numbers from −1 to -2ⁿ⁻¹, n being the word size of the machine, and the numeric complement of a number is its two's complement.

  • Nearly all modern computers use two's complement for integer arithmetic.
Related terms
complement, radix complement, numeric complement, ones' complement, signed magnitude

Entry derived from the Wiktionary, under licence CC BY-SA 4.0 — list of authors.