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;
- 12 345 678 901 194 ÷ 2 = 6 172 839 450 597 + 0;
- 6 172 839 450 597 ÷ 2 = 3 086 419 725 298 + 1;
- 3 086 419 725 298 ÷ 2 = 1 543 209 862 649 + 0;
- 1 543 209 862 649 ÷ 2 = 771 604 931 324 + 1;
- 771 604 931 324 ÷ 2 = 385 802 465 662 + 0;
- 385 802 465 662 ÷ 2 = 192 901 232 831 + 0;
- 192 901 232 831 ÷ 2 = 96 450 616 415 + 1;
- 96 450 616 415 ÷ 2 = 48 225 308 207 + 1;
- 48 225 308 207 ÷ 2 = 24 112 654 103 + 1;
- 24 112 654 103 ÷ 2 = 12 056 327 051 + 1;
- 12 056 327 051 ÷ 2 = 6 028 163 525 + 1;
- 6 028 163 525 ÷ 2 = 3 014 081 762 + 1;
- 3 014 081 762 ÷ 2 = 1 507 040 881 + 0;
- 1 507 040 881 ÷ 2 = 753 520 440 + 1;
- 753 520 440 ÷ 2 = 376 760 220 + 0;
- 376 760 220 ÷ 2 = 188 380 110 + 0;
- 188 380 110 ÷ 2 = 94 190 055 + 0;
- 94 190 055 ÷ 2 = 47 095 027 + 1;
- 47 095 027 ÷ 2 = 23 547 513 + 1;
- 23 547 513 ÷ 2 = 11 773 756 + 1;
- 11 773 756 ÷ 2 = 5 886 878 + 0;
- 5 886 878 ÷ 2 = 2 943 439 + 0;
- 2 943 439 ÷ 2 = 1 471 719 + 1;
- 1 471 719 ÷ 2 = 735 859 + 1;
- 735 859 ÷ 2 = 367 929 + 1;
- 367 929 ÷ 2 = 183 964 + 1;
- 183 964 ÷ 2 = 91 982 + 0;
- 91 982 ÷ 2 = 45 991 + 0;
- 45 991 ÷ 2 = 22 995 + 1;
- 22 995 ÷ 2 = 11 497 + 1;
- 11 497 ÷ 2 = 5 748 + 1;
- 5 748 ÷ 2 = 2 874 + 0;
- 2 874 ÷ 2 = 1 437 + 0;
- 1 437 ÷ 2 = 718 + 1;
- 718 ÷ 2 = 359 + 0;
- 359 ÷ 2 = 179 + 1;
- 179 ÷ 2 = 89 + 1;
- 89 ÷ 2 = 44 + 1;
- 44 ÷ 2 = 22 + 0;
- 22 ÷ 2 = 11 + 0;
- 11 ÷ 2 = 5 + 1;
- 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.
12 345 678 901 194(10) = 1011 0011 1010 0111 0011 1100 1110 0010 1111 1100 1010(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 44.
- 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, 44,
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 12 345 678 901 194(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.