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;
- 6 666 134 843 ÷ 2 = 3 333 067 421 + 1;
- 3 333 067 421 ÷ 2 = 1 666 533 710 + 1;
- 1 666 533 710 ÷ 2 = 833 266 855 + 0;
- 833 266 855 ÷ 2 = 416 633 427 + 1;
- 416 633 427 ÷ 2 = 208 316 713 + 1;
- 208 316 713 ÷ 2 = 104 158 356 + 1;
- 104 158 356 ÷ 2 = 52 079 178 + 0;
- 52 079 178 ÷ 2 = 26 039 589 + 0;
- 26 039 589 ÷ 2 = 13 019 794 + 1;
- 13 019 794 ÷ 2 = 6 509 897 + 0;
- 6 509 897 ÷ 2 = 3 254 948 + 1;
- 3 254 948 ÷ 2 = 1 627 474 + 0;
- 1 627 474 ÷ 2 = 813 737 + 0;
- 813 737 ÷ 2 = 406 868 + 1;
- 406 868 ÷ 2 = 203 434 + 0;
- 203 434 ÷ 2 = 101 717 + 0;
- 101 717 ÷ 2 = 50 858 + 1;
- 50 858 ÷ 2 = 25 429 + 0;
- 25 429 ÷ 2 = 12 714 + 1;
- 12 714 ÷ 2 = 6 357 + 0;
- 6 357 ÷ 2 = 3 178 + 1;
- 3 178 ÷ 2 = 1 589 + 0;
- 1 589 ÷ 2 = 794 + 1;
- 794 ÷ 2 = 397 + 0;
- 397 ÷ 2 = 198 + 1;
- 198 ÷ 2 = 99 + 0;
- 99 ÷ 2 = 49 + 1;
- 49 ÷ 2 = 24 + 1;
- 24 ÷ 2 = 12 + 0;
- 12 ÷ 2 = 6 + 0;
- 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.
6 666 134 843(10) = 1 1000 1101 0101 0101 0010 0101 0011 1011(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 33.
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, 33,
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.
Number 6 666 134 843(10), a signed integer number (with sign), converted from decimal system (from base 10) and written as a signed binary in two's complement representation:
6 666 134 843(10) = 0000 0000 0000 0000 0000 0000 0000 0001 1000 1101 0101 0101 0010 0101 0011 1011
Spaces were used to group digits: for binary, by 4, for decimal, by 3.