1. Divide the number repeatedly by 2:
Keep track of each remainder.
We stop when we get a quotient that is equal to zero.
- division = quotient + remainder;
- 286 780 219 ÷ 2 = 143 390 109 + 1;
- 143 390 109 ÷ 2 = 71 695 054 + 1;
- 71 695 054 ÷ 2 = 35 847 527 + 0;
- 35 847 527 ÷ 2 = 17 923 763 + 1;
- 17 923 763 ÷ 2 = 8 961 881 + 1;
- 8 961 881 ÷ 2 = 4 480 940 + 1;
- 4 480 940 ÷ 2 = 2 240 470 + 0;
- 2 240 470 ÷ 2 = 1 120 235 + 0;
- 1 120 235 ÷ 2 = 560 117 + 1;
- 560 117 ÷ 2 = 280 058 + 1;
- 280 058 ÷ 2 = 140 029 + 0;
- 140 029 ÷ 2 = 70 014 + 1;
- 70 014 ÷ 2 = 35 007 + 0;
- 35 007 ÷ 2 = 17 503 + 1;
- 17 503 ÷ 2 = 8 751 + 1;
- 8 751 ÷ 2 = 4 375 + 1;
- 4 375 ÷ 2 = 2 187 + 1;
- 2 187 ÷ 2 = 1 093 + 1;
- 1 093 ÷ 2 = 546 + 1;
- 546 ÷ 2 = 273 + 0;
- 273 ÷ 2 = 136 + 1;
- 136 ÷ 2 = 68 + 0;
- 68 ÷ 2 = 34 + 0;
- 34 ÷ 2 = 17 + 0;
- 17 ÷ 2 = 8 + 1;
- 8 ÷ 2 = 4 + 0;
- 4 ÷ 2 = 2 + 0;
- 2 ÷ 2 = 1 + 0;
- 1 ÷ 2 = 0 + 1;
2. Construct the base 2 representation of the positive number:
Take all the remainders starting from the bottom of the list constructed above.
286 780 219(10) = 1 0001 0001 0111 1110 1011 0011 1011(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 29.
- A signed binary's bit length must be equal to a power of 2, as of:
- 21 = 2; 22 = 4; 23 = 8; 24 = 16; 25 = 32; 26 = 64; ...
- The first bit (the leftmost) indicates the sign:
- 0 = positive integer number, 1 = negative integer number
The least number that is:
1) a power of 2
2) and is larger than the actual length, 29,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 32.
4. Get the positive binary computer representation on 32 bits (4 Bytes):
If needed, add extra 0s in front (to the left) of the base 2 number, up to the required length, 32.
Decimal Number 286 780 219(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.