1. Divide the number repeatedly by 2:
Keep track of each remainder.
Stop when you get a quotient that is equal to zero.
- division = quotient + remainder;
- 3 518 476 059 ÷ 2 = 1 759 238 029 + 1;
- 1 759 238 029 ÷ 2 = 879 619 014 + 1;
- 879 619 014 ÷ 2 = 439 809 507 + 0;
- 439 809 507 ÷ 2 = 219 904 753 + 1;
- 219 904 753 ÷ 2 = 109 952 376 + 1;
- 109 952 376 ÷ 2 = 54 976 188 + 0;
- 54 976 188 ÷ 2 = 27 488 094 + 0;
- 27 488 094 ÷ 2 = 13 744 047 + 0;
- 13 744 047 ÷ 2 = 6 872 023 + 1;
- 6 872 023 ÷ 2 = 3 436 011 + 1;
- 3 436 011 ÷ 2 = 1 718 005 + 1;
- 1 718 005 ÷ 2 = 859 002 + 1;
- 859 002 ÷ 2 = 429 501 + 0;
- 429 501 ÷ 2 = 214 750 + 1;
- 214 750 ÷ 2 = 107 375 + 0;
- 107 375 ÷ 2 = 53 687 + 1;
- 53 687 ÷ 2 = 26 843 + 1;
- 26 843 ÷ 2 = 13 421 + 1;
- 13 421 ÷ 2 = 6 710 + 1;
- 6 710 ÷ 2 = 3 355 + 0;
- 3 355 ÷ 2 = 1 677 + 1;
- 1 677 ÷ 2 = 838 + 1;
- 838 ÷ 2 = 419 + 0;
- 419 ÷ 2 = 209 + 1;
- 209 ÷ 2 = 104 + 1;
- 104 ÷ 2 = 52 + 0;
- 52 ÷ 2 = 26 + 0;
- 26 ÷ 2 = 13 + 0;
- 13 ÷ 2 = 6 + 1;
- 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.
3 518 476 059(10) = 1101 0001 1011 0111 1010 1111 0001 1011(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 3 518 476 059(10) converted to signed binary in one's complement representation: