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;
- 5 209 827 775 ÷ 2 = 2 604 913 887 + 1;
- 2 604 913 887 ÷ 2 = 1 302 456 943 + 1;
- 1 302 456 943 ÷ 2 = 651 228 471 + 1;
- 651 228 471 ÷ 2 = 325 614 235 + 1;
- 325 614 235 ÷ 2 = 162 807 117 + 1;
- 162 807 117 ÷ 2 = 81 403 558 + 1;
- 81 403 558 ÷ 2 = 40 701 779 + 0;
- 40 701 779 ÷ 2 = 20 350 889 + 1;
- 20 350 889 ÷ 2 = 10 175 444 + 1;
- 10 175 444 ÷ 2 = 5 087 722 + 0;
- 5 087 722 ÷ 2 = 2 543 861 + 0;
- 2 543 861 ÷ 2 = 1 271 930 + 1;
- 1 271 930 ÷ 2 = 635 965 + 0;
- 635 965 ÷ 2 = 317 982 + 1;
- 317 982 ÷ 2 = 158 991 + 0;
- 158 991 ÷ 2 = 79 495 + 1;
- 79 495 ÷ 2 = 39 747 + 1;
- 39 747 ÷ 2 = 19 873 + 1;
- 19 873 ÷ 2 = 9 936 + 1;
- 9 936 ÷ 2 = 4 968 + 0;
- 4 968 ÷ 2 = 2 484 + 0;
- 2 484 ÷ 2 = 1 242 + 0;
- 1 242 ÷ 2 = 621 + 0;
- 621 ÷ 2 = 310 + 1;
- 310 ÷ 2 = 155 + 0;
- 155 ÷ 2 = 77 + 1;
- 77 ÷ 2 = 38 + 1;
- 38 ÷ 2 = 19 + 0;
- 19 ÷ 2 = 9 + 1;
- 9 ÷ 2 = 4 + 1;
- 4 ÷ 2 = 2 + 0;
- 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.
5 209 827 775(10) = 1 0011 0110 1000 0111 1010 1001 1011 1111(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 5 209 827 775(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:
5 209 827 775(10) = 0000 0000 0000 0000 0000 0000 0000 0001 0011 0110 1000 0111 1010 1001 1011 1111
Spaces were used to group digits: for binary, by 4, for decimal, by 3.