1. Start with the positive version of the number:
|-889 268 308| = 889 268 308
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;
- 889 268 308 ÷ 2 = 444 634 154 + 0;
- 444 634 154 ÷ 2 = 222 317 077 + 0;
- 222 317 077 ÷ 2 = 111 158 538 + 1;
- 111 158 538 ÷ 2 = 55 579 269 + 0;
- 55 579 269 ÷ 2 = 27 789 634 + 1;
- 27 789 634 ÷ 2 = 13 894 817 + 0;
- 13 894 817 ÷ 2 = 6 947 408 + 1;
- 6 947 408 ÷ 2 = 3 473 704 + 0;
- 3 473 704 ÷ 2 = 1 736 852 + 0;
- 1 736 852 ÷ 2 = 868 426 + 0;
- 868 426 ÷ 2 = 434 213 + 0;
- 434 213 ÷ 2 = 217 106 + 1;
- 217 106 ÷ 2 = 108 553 + 0;
- 108 553 ÷ 2 = 54 276 + 1;
- 54 276 ÷ 2 = 27 138 + 0;
- 27 138 ÷ 2 = 13 569 + 0;
- 13 569 ÷ 2 = 6 784 + 1;
- 6 784 ÷ 2 = 3 392 + 0;
- 3 392 ÷ 2 = 1 696 + 0;
- 1 696 ÷ 2 = 848 + 0;
- 848 ÷ 2 = 424 + 0;
- 424 ÷ 2 = 212 + 0;
- 212 ÷ 2 = 106 + 0;
- 106 ÷ 2 = 53 + 0;
- 53 ÷ 2 = 26 + 1;
- 26 ÷ 2 = 13 + 0;
- 13 ÷ 2 = 6 + 1;
- 6 ÷ 2 = 3 + 0;
- 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.
889 268 308(10) = 11 0101 0000 0001 0010 1000 0101 0100(2)
4. 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.
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.