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;
- 121 212 121 211 903 ÷ 2 = 60 606 060 605 951 + 1;
- 60 606 060 605 951 ÷ 2 = 30 303 030 302 975 + 1;
- 30 303 030 302 975 ÷ 2 = 15 151 515 151 487 + 1;
- 15 151 515 151 487 ÷ 2 = 7 575 757 575 743 + 1;
- 7 575 757 575 743 ÷ 2 = 3 787 878 787 871 + 1;
- 3 787 878 787 871 ÷ 2 = 1 893 939 393 935 + 1;
- 1 893 939 393 935 ÷ 2 = 946 969 696 967 + 1;
- 946 969 696 967 ÷ 2 = 473 484 848 483 + 1;
- 473 484 848 483 ÷ 2 = 236 742 424 241 + 1;
- 236 742 424 241 ÷ 2 = 118 371 212 120 + 1;
- 118 371 212 120 ÷ 2 = 59 185 606 060 + 0;
- 59 185 606 060 ÷ 2 = 29 592 803 030 + 0;
- 29 592 803 030 ÷ 2 = 14 796 401 515 + 0;
- 14 796 401 515 ÷ 2 = 7 398 200 757 + 1;
- 7 398 200 757 ÷ 2 = 3 699 100 378 + 1;
- 3 699 100 378 ÷ 2 = 1 849 550 189 + 0;
- 1 849 550 189 ÷ 2 = 924 775 094 + 1;
- 924 775 094 ÷ 2 = 462 387 547 + 0;
- 462 387 547 ÷ 2 = 231 193 773 + 1;
- 231 193 773 ÷ 2 = 115 596 886 + 1;
- 115 596 886 ÷ 2 = 57 798 443 + 0;
- 57 798 443 ÷ 2 = 28 899 221 + 1;
- 28 899 221 ÷ 2 = 14 449 610 + 1;
- 14 449 610 ÷ 2 = 7 224 805 + 0;
- 7 224 805 ÷ 2 = 3 612 402 + 1;
- 3 612 402 ÷ 2 = 1 806 201 + 0;
- 1 806 201 ÷ 2 = 903 100 + 1;
- 903 100 ÷ 2 = 451 550 + 0;
- 451 550 ÷ 2 = 225 775 + 0;
- 225 775 ÷ 2 = 112 887 + 1;
- 112 887 ÷ 2 = 56 443 + 1;
- 56 443 ÷ 2 = 28 221 + 1;
- 28 221 ÷ 2 = 14 110 + 1;
- 14 110 ÷ 2 = 7 055 + 0;
- 7 055 ÷ 2 = 3 527 + 1;
- 3 527 ÷ 2 = 1 763 + 1;
- 1 763 ÷ 2 = 881 + 1;
- 881 ÷ 2 = 440 + 1;
- 440 ÷ 2 = 220 + 0;
- 220 ÷ 2 = 110 + 0;
- 110 ÷ 2 = 55 + 0;
- 55 ÷ 2 = 27 + 1;
- 27 ÷ 2 = 13 + 1;
- 13 ÷ 2 = 6 + 1;
- 6 ÷ 2 = 3 + 0;
- 3 ÷ 2 = 1 + 1;
- 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.
121 212 121 211 903(10) = 110 1110 0011 1101 1110 0101 0110 1101 0110 0011 1111 1111(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 47.
- 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, 47,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 64.
4. Get the positive binary computer representation on 64 bits (8 Bytes):
If needed, add extra 0s in front (to the left) of the base 2 number, up to the required length, 64.
Decimal Number 121 212 121 211 903(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.