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

-474 in binary (2's complement on 16 bits) is: 1111 1110 0010 0110

(474)10=(1111 1110 0010 0110)2(-474)_{10}=(1111~1110~0010~0110)_2


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

1. absolute value conversion (474)

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

  • 474÷2=237474 \div 2 = 237, remainder 0
  • 237÷2=118237 \div 2 = 118, remainder 1
  • 118÷2=59118 \div 2 = 59, remainder 0
  • 59÷2=2959 \div 2 = 29, remainder 1
  • 29÷2=1429 \div 2 = 14, remainder 1
  • 14÷2=714 \div 2 = 7, remainder 0
  • 7÷2=37 \div 2 = 3, remainder 1
  • 3÷2=13 \div 2 = 1, remainder 1
  • 1÷2=01 \div 2 = 0, remainder 1

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

(474)10=(111011010)2(-474)_ {10} = (111011010)_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 474 (111011010)

  • Inverted: 000100101

Step 2 : Add 1

  • 000100101 + 1 = 000100110

Step 3 : Complete with 1s

  • Add 1's to obtain a 16-bit representation: 1111 1110 0010 0110

On 16 bits, this gives :

(474)10=(1111 1110 0010 0110)2(-474)_{10}=(1111~1110~0010~0110)_2