1. Start with the positive version of the number:
|-1 045 431 484| = 1 045 431 484
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 045 431 484 ÷ 2 = 522 715 742 + 0;
- 522 715 742 ÷ 2 = 261 357 871 + 0;
- 261 357 871 ÷ 2 = 130 678 935 + 1;
- 130 678 935 ÷ 2 = 65 339 467 + 1;
- 65 339 467 ÷ 2 = 32 669 733 + 1;
- 32 669 733 ÷ 2 = 16 334 866 + 1;
- 16 334 866 ÷ 2 = 8 167 433 + 0;
- 8 167 433 ÷ 2 = 4 083 716 + 1;
- 4 083 716 ÷ 2 = 2 041 858 + 0;
- 2 041 858 ÷ 2 = 1 020 929 + 0;
- 1 020 929 ÷ 2 = 510 464 + 1;
- 510 464 ÷ 2 = 255 232 + 0;
- 255 232 ÷ 2 = 127 616 + 0;
- 127 616 ÷ 2 = 63 808 + 0;
- 63 808 ÷ 2 = 31 904 + 0;
- 31 904 ÷ 2 = 15 952 + 0;
- 15 952 ÷ 2 = 7 976 + 0;
- 7 976 ÷ 2 = 3 988 + 0;
- 3 988 ÷ 2 = 1 994 + 0;
- 1 994 ÷ 2 = 997 + 0;
- 997 ÷ 2 = 498 + 1;
- 498 ÷ 2 = 249 + 0;
- 249 ÷ 2 = 124 + 1;
- 124 ÷ 2 = 62 + 0;
- 62 ÷ 2 = 31 + 0;
- 31 ÷ 2 = 15 + 1;
- 15 ÷ 2 = 7 + 1;
- 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 045 431 484(10) = 11 1110 0101 0000 0000 0100 1011 1100(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.