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;
- 767 520 061 ÷ 2 = 383 760 030 + 1;
- 383 760 030 ÷ 2 = 191 880 015 + 0;
- 191 880 015 ÷ 2 = 95 940 007 + 1;
- 95 940 007 ÷ 2 = 47 970 003 + 1;
- 47 970 003 ÷ 2 = 23 985 001 + 1;
- 23 985 001 ÷ 2 = 11 992 500 + 1;
- 11 992 500 ÷ 2 = 5 996 250 + 0;
- 5 996 250 ÷ 2 = 2 998 125 + 0;
- 2 998 125 ÷ 2 = 1 499 062 + 1;
- 1 499 062 ÷ 2 = 749 531 + 0;
- 749 531 ÷ 2 = 374 765 + 1;
- 374 765 ÷ 2 = 187 382 + 1;
- 187 382 ÷ 2 = 93 691 + 0;
- 93 691 ÷ 2 = 46 845 + 1;
- 46 845 ÷ 2 = 23 422 + 1;
- 23 422 ÷ 2 = 11 711 + 0;
- 11 711 ÷ 2 = 5 855 + 1;
- 5 855 ÷ 2 = 2 927 + 1;
- 2 927 ÷ 2 = 1 463 + 1;
- 1 463 ÷ 2 = 731 + 1;
- 731 ÷ 2 = 365 + 1;
- 365 ÷ 2 = 182 + 1;
- 182 ÷ 2 = 91 + 0;
- 91 ÷ 2 = 45 + 1;
- 45 ÷ 2 = 22 + 1;
- 22 ÷ 2 = 11 + 0;
- 11 ÷ 2 = 5 + 1;
- 5 ÷ 2 = 2 + 1;
- 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.
767 520 061(10) = 10 1101 1011 1111 0110 1101 0011 1101(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 30.
- 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, 30,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 32.
4. Get the positive binary computer representation on 32 bits (4 Bytes):
If needed, add extra 0s in front (to the left) of the base 2 number, up to the required length, 32.
Decimal Number 767 520 061(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.