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 828 434 ÷ 2 = 2 604 914 217 + 0;
- 2 604 914 217 ÷ 2 = 1 302 457 108 + 1;
- 1 302 457 108 ÷ 2 = 651 228 554 + 0;
- 651 228 554 ÷ 2 = 325 614 277 + 0;
- 325 614 277 ÷ 2 = 162 807 138 + 1;
- 162 807 138 ÷ 2 = 81 403 569 + 0;
- 81 403 569 ÷ 2 = 40 701 784 + 1;
- 40 701 784 ÷ 2 = 20 350 892 + 0;
- 20 350 892 ÷ 2 = 10 175 446 + 0;
- 10 175 446 ÷ 2 = 5 087 723 + 0;
- 5 087 723 ÷ 2 = 2 543 861 + 1;
- 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 828 434(10) = 1 0011 0110 1000 0111 1010 1100 0101 0010(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.
Decimal Number 5 209 828 434(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.