1. Divide the number repeatedly by 2:
Keep track of each remainder.
Stop when you get a quotient that is equal to zero.
- division = quotient + remainder;
- 1 364 098 333 ÷ 2 = 682 049 166 + 1;
- 682 049 166 ÷ 2 = 341 024 583 + 0;
- 341 024 583 ÷ 2 = 170 512 291 + 1;
- 170 512 291 ÷ 2 = 85 256 145 + 1;
- 85 256 145 ÷ 2 = 42 628 072 + 1;
- 42 628 072 ÷ 2 = 21 314 036 + 0;
- 21 314 036 ÷ 2 = 10 657 018 + 0;
- 10 657 018 ÷ 2 = 5 328 509 + 0;
- 5 328 509 ÷ 2 = 2 664 254 + 1;
- 2 664 254 ÷ 2 = 1 332 127 + 0;
- 1 332 127 ÷ 2 = 666 063 + 1;
- 666 063 ÷ 2 = 333 031 + 1;
- 333 031 ÷ 2 = 166 515 + 1;
- 166 515 ÷ 2 = 83 257 + 1;
- 83 257 ÷ 2 = 41 628 + 1;
- 41 628 ÷ 2 = 20 814 + 0;
- 20 814 ÷ 2 = 10 407 + 0;
- 10 407 ÷ 2 = 5 203 + 1;
- 5 203 ÷ 2 = 2 601 + 1;
- 2 601 ÷ 2 = 1 300 + 1;
- 1 300 ÷ 2 = 650 + 0;
- 650 ÷ 2 = 325 + 0;
- 325 ÷ 2 = 162 + 1;
- 162 ÷ 2 = 81 + 0;
- 81 ÷ 2 = 40 + 1;
- 40 ÷ 2 = 20 + 0;
- 20 ÷ 2 = 10 + 0;
- 10 ÷ 2 = 5 + 0;
- 5 ÷ 2 = 2 + 1;
- 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.
1 364 098 333(10) = 101 0001 0100 1110 0111 1101 0001 1101(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 31.
- 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, 31,
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 1 364 098 333(10) converted to signed binary in one's complement representation: