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;
- 2 566 912 949 ÷ 2 = 1 283 456 474 + 1;
- 1 283 456 474 ÷ 2 = 641 728 237 + 0;
- 641 728 237 ÷ 2 = 320 864 118 + 1;
- 320 864 118 ÷ 2 = 160 432 059 + 0;
- 160 432 059 ÷ 2 = 80 216 029 + 1;
- 80 216 029 ÷ 2 = 40 108 014 + 1;
- 40 108 014 ÷ 2 = 20 054 007 + 0;
- 20 054 007 ÷ 2 = 10 027 003 + 1;
- 10 027 003 ÷ 2 = 5 013 501 + 1;
- 5 013 501 ÷ 2 = 2 506 750 + 1;
- 2 506 750 ÷ 2 = 1 253 375 + 0;
- 1 253 375 ÷ 2 = 626 687 + 1;
- 626 687 ÷ 2 = 313 343 + 1;
- 313 343 ÷ 2 = 156 671 + 1;
- 156 671 ÷ 2 = 78 335 + 1;
- 78 335 ÷ 2 = 39 167 + 1;
- 39 167 ÷ 2 = 19 583 + 1;
- 19 583 ÷ 2 = 9 791 + 1;
- 9 791 ÷ 2 = 4 895 + 1;
- 4 895 ÷ 2 = 2 447 + 1;
- 2 447 ÷ 2 = 1 223 + 1;
- 1 223 ÷ 2 = 611 + 1;
- 611 ÷ 2 = 305 + 1;
- 305 ÷ 2 = 152 + 1;
- 152 ÷ 2 = 76 + 0;
- 76 ÷ 2 = 38 + 0;
- 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.
2 566 912 949(10) = 1001 1000 1111 1111 1111 1011 1011 0101(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 32.
- 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, 32,
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 2 566 912 949(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.