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

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

(297)10=(1111 1110 1101 0111)2(-297)_{10}=(1111~1110~1101~0111)_2


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

1. absolute value conversion (297)

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

  • 297÷2=148297 \div 2 = 148, remainder 1
  • 148÷2=74148 \div 2 = 74, remainder 0
  • 74÷2=3774 \div 2 = 37, remainder 0
  • 37÷2=1837 \div 2 = 18, remainder 1
  • 18÷2=918 \div 2 = 9, remainder 0
  • 9÷2=49 \div 2 = 4, remainder 1
  • 4÷2=24 \div 2 = 2, remainder 0
  • 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 297297 is :

(297)10=(100101001)2(-297)_ {10} = (100101001)_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 1440297 (100101001)

  • Inverted: 011010110

Step 2 : Add 1

  • 011010110 + 1 = 011010111

Step 3 : Complete with 1s

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

On 16 bits, this gives :

(297)10=(1111 1110 1101 0111)2(-297)_{10}=(1111~1110~1101~0111)_2