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;
- 3 259 826 016 ÷ 2 = 1 629 913 008 + 0;
- 1 629 913 008 ÷ 2 = 814 956 504 + 0;
- 814 956 504 ÷ 2 = 407 478 252 + 0;
- 407 478 252 ÷ 2 = 203 739 126 + 0;
- 203 739 126 ÷ 2 = 101 869 563 + 0;
- 101 869 563 ÷ 2 = 50 934 781 + 1;
- 50 934 781 ÷ 2 = 25 467 390 + 1;
- 25 467 390 ÷ 2 = 12 733 695 + 0;
- 12 733 695 ÷ 2 = 6 366 847 + 1;
- 6 366 847 ÷ 2 = 3 183 423 + 1;
- 3 183 423 ÷ 2 = 1 591 711 + 1;
- 1 591 711 ÷ 2 = 795 855 + 1;
- 795 855 ÷ 2 = 397 927 + 1;
- 397 927 ÷ 2 = 198 963 + 1;
- 198 963 ÷ 2 = 99 481 + 1;
- 99 481 ÷ 2 = 49 740 + 1;
- 49 740 ÷ 2 = 24 870 + 0;
- 24 870 ÷ 2 = 12 435 + 0;
- 12 435 ÷ 2 = 6 217 + 1;
- 6 217 ÷ 2 = 3 108 + 1;
- 3 108 ÷ 2 = 1 554 + 0;
- 1 554 ÷ 2 = 777 + 0;
- 777 ÷ 2 = 388 + 1;
- 388 ÷ 2 = 194 + 0;
- 194 ÷ 2 = 97 + 0;
- 97 ÷ 2 = 48 + 1;
- 48 ÷ 2 = 24 + 0;
- 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.
3 259 826 016(10) = 1100 0010 0100 1100 1111 1111 0110 0000(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 259 826 016(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.