Glossary definition of 'Twos complement'

The two's complement system is a way of representing negative numbers in binary.

Using the two's complement system, we represent negative numbers by adding a large offset to them so that they are larger than the largest positive number we need to represent by a known amount. This simplifies some mathematical operations when processing the data.

For an n-bit binary system we may want to be able to represent positive and negative values from +2n-1 down to -2n-1. We could do this by using the MSB (Most significant bit) to give a sign to any number. This would work but has some anomalies such as +0 and -0.

Using the two's complement system, positive values from 0 to 2n-1 remain the same, but negative values from -1 to -2n-1 are represented as their value plus 2n. For example, in an 8 bit two's complement system, the numbers from 00000000 to 01111111 represent the positive numbers, but negative 1 is represented as 28 (or 100000000) add -1 or 11111111. Similarly -2 becomes 11111110 and -128 becomes 10000000.

Digital audio binary words are always represented in two's complement form.