1. Start with the positive version of the number:
|-1 979 711 567| = 1 979 711 567
2. 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;
- 1 979 711 567 ÷ 2 = 989 855 783 + 1;
- 989 855 783 ÷ 2 = 494 927 891 + 1;
- 494 927 891 ÷ 2 = 247 463 945 + 1;
- 247 463 945 ÷ 2 = 123 731 972 + 1;
- 123 731 972 ÷ 2 = 61 865 986 + 0;
- 61 865 986 ÷ 2 = 30 932 993 + 0;
- 30 932 993 ÷ 2 = 15 466 496 + 1;
- 15 466 496 ÷ 2 = 7 733 248 + 0;
- 7 733 248 ÷ 2 = 3 866 624 + 0;
- 3 866 624 ÷ 2 = 1 933 312 + 0;
- 1 933 312 ÷ 2 = 966 656 + 0;
- 966 656 ÷ 2 = 483 328 + 0;
- 483 328 ÷ 2 = 241 664 + 0;
- 241 664 ÷ 2 = 120 832 + 0;
- 120 832 ÷ 2 = 60 416 + 0;
- 60 416 ÷ 2 = 30 208 + 0;
- 30 208 ÷ 2 = 15 104 + 0;
- 15 104 ÷ 2 = 7 552 + 0;
- 7 552 ÷ 2 = 3 776 + 0;
- 3 776 ÷ 2 = 1 888 + 0;
- 1 888 ÷ 2 = 944 + 0;
- 944 ÷ 2 = 472 + 0;
- 472 ÷ 2 = 236 + 0;
- 236 ÷ 2 = 118 + 0;
- 118 ÷ 2 = 59 + 0;
- 59 ÷ 2 = 29 + 1;
- 29 ÷ 2 = 14 + 1;
- 14 ÷ 2 = 7 + 0;
- 7 ÷ 2 = 3 + 1;
- 3 ÷ 2 = 1 + 1;
- 1 ÷ 2 = 0 + 1;
3. Construct the base 2 representation of the positive number:
Take all the remainders starting from the bottom of the list constructed above.
1 979 711 567(10) = 111 0110 0000 0000 0000 0000 0100 1111(2)
4. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 31.
- 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, 31,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 32.
5. 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.