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;
- 728 822 097 ÷ 2 = 364 411 048 + 1;
- 364 411 048 ÷ 2 = 182 205 524 + 0;
- 182 205 524 ÷ 2 = 91 102 762 + 0;
- 91 102 762 ÷ 2 = 45 551 381 + 0;
- 45 551 381 ÷ 2 = 22 775 690 + 1;
- 22 775 690 ÷ 2 = 11 387 845 + 0;
- 11 387 845 ÷ 2 = 5 693 922 + 1;
- 5 693 922 ÷ 2 = 2 846 961 + 0;
- 2 846 961 ÷ 2 = 1 423 480 + 1;
- 1 423 480 ÷ 2 = 711 740 + 0;
- 711 740 ÷ 2 = 355 870 + 0;
- 355 870 ÷ 2 = 177 935 + 0;
- 177 935 ÷ 2 = 88 967 + 1;
- 88 967 ÷ 2 = 44 483 + 1;
- 44 483 ÷ 2 = 22 241 + 1;
- 22 241 ÷ 2 = 11 120 + 1;
- 11 120 ÷ 2 = 5 560 + 0;
- 5 560 ÷ 2 = 2 780 + 0;
- 2 780 ÷ 2 = 1 390 + 0;
- 1 390 ÷ 2 = 695 + 0;
- 695 ÷ 2 = 347 + 1;
- 347 ÷ 2 = 173 + 1;
- 173 ÷ 2 = 86 + 1;
- 86 ÷ 2 = 43 + 0;
- 43 ÷ 2 = 21 + 1;
- 21 ÷ 2 = 10 + 1;
- 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.
728 822 097(10) = 10 1011 0111 0000 1111 0001 0101 0001(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 30.
- 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, 30,
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 728 822 097(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.