user
What is the conversion of -647 from decimal to binary base?
alphonsio

-647 in binary (2's complement on 16 bits) is: 1111 1101 0111 1001

(647)10=(1111 1101 0111 1001)2(-647)_{10}=(1111~1101~0111~1001)_2


To convert the number -647 from decimal to binary, we first convert the positive number 647 to binary, then encode the negative sign (2's complement).

1. absolute value conversion (647)

Let's divide 647647 by 22 and note the remainder at each step:

  • 647÷2=323647 \div 2 = 323, remainder 1
  • 323÷2=161323 \div 2 = 161, remainder 1
  • 161÷2=80161 \div 2 = 80, remainder 1
  • 80÷2=4080 \div 2 = 40, remainder 0
  • 40÷2=2040 \div 2 = 20, remainder 0
  • 20÷2=1020 \div 2 = 10, remainder 0
  • 10÷2=510 \div 2 = 5, remainder 0
  • 5÷2=25 \div 2 = 2, remainder 1
  • 2÷2=12 \div 2 = 1, remainder 0
  • 1÷2=01 \div 2 = 0, remainder 1

Reading the remainders from bottom to top, the binary conversion of 647647 is :

(647)10=(1010000111)2(-647)_ {10} = (1010000111)_2

2. Negative sign

The negative sign is represented by the 2's complement. Invert each bit and add 1 to the result:

Step 1: invert the bits of 647 (1010000111)

  • Inverted: 0101111000

Step 2 : Add 1

  • 0101111000 + 1 = 0101111001

Step 3 : Complete with 1s

  • Add 1's to obtain a 16-bit representation: 1111 1101 0111 1001

On 16 bits, this gives :

(647)10=(1111 1101 0111 1001)2(-647)_{10}=(1111~1101~0111~1001)_2