Signed magnitude reserves the first bit for the sign. Ones complement represents a negative value by inverting every bit of its positive representation. Twos complement inverts the bits and adds one. Always choose the word width before encoding a negative value.

Worked example

With four bits, +3 is 0011. Signed-magnitude −3 is 1011; ones-complement −3 is 1100; twos-complement −3 is 1101. Four-bit twos complement covers −8 through +7 and has only one zero representation.

What to watch for

The same bits can mean different values under different encodings. Signed magnitude and ones complement each have two representations of zero.

Try it yourself

Encode −5 in four-bit twos complement.

Answer: +5 is 0101. Invert to obtain 1010, then add one to obtain 1011. Interpreting it as unsigned would instead give 11.

How to study this topic

Write the base and bit width beside every value. Expand place weights before using a shortcut, then convert your answer back to decimal as an independent check. Representation and value are different ideas.

Explore related programmes

These recorded programmes are upcoming. This article is general educational content, not a syllabus or course sample.

Digital Electronics