−1000 in 16-bit two's complement

edge casea value that needs more than a byte

Answer

1111110000011000

Why this example is worth doing

A magnitude too large for eight bits, which forces the width question to the front: two's complement is meaningless without a declared width, since the same bits mean different values at different widths. The tool requires the width as an input rather than inferring it, and the page explains that this is why every processor instruction set specifies operand size explicitly.

Try your own input in the Two’s complement. Encode and decode signed binary at any width, with overflow and sign extension.

How the answer is reached

-1000 in 16-bit two's complement

Encode -1000 in 16-bit two's complement. Representable range: -32768 to 32767.

|-1000| in binary0000001111101000

invert every bit1111110000010111

add 11111110000011000invert-and-add-one is the negation rule

16-bit pattern1111 1100 0001 10000xFC18

check1111110000011000 reads 64536 unsigned and -1000 signed

Compare with

Open this example in the Two’s complement

The field arrives filled in with this example’s input.

Note:

Notation this page assumes

  • Bit strings are written most significant bit first, and bit 0 is the least significant bit.
  • A width is stated explicitly wherever it changes the answer; nothing is silently sign-extended or truncated.
  • Negative values are two’s complement, not sign–magnitude, and the most significant bit is the sign bit.

Sources

  • Knuth, The Art of Computer Programming, Vol. 2, §4.1 “Positional Number Systems” (1997)
  • IEEE 754-2019, Standard for Floating-Point Arithmetic