1. 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;
- 830 828 ÷ 2 = 415 414 + 0;
- 415 414 ÷ 2 = 207 707 + 0;
- 207 707 ÷ 2 = 103 853 + 1;
- 103 853 ÷ 2 = 51 926 + 1;
- 51 926 ÷ 2 = 25 963 + 0;
- 25 963 ÷ 2 = 12 981 + 1;
- 12 981 ÷ 2 = 6 490 + 1;
- 6 490 ÷ 2 = 3 245 + 0;
- 3 245 ÷ 2 = 1 622 + 1;
- 1 622 ÷ 2 = 811 + 0;
- 811 ÷ 2 = 405 + 1;
- 405 ÷ 2 = 202 + 1;
- 202 ÷ 2 = 101 + 0;
- 101 ÷ 2 = 50 + 1;
- 50 ÷ 2 = 25 + 0;
- 25 ÷ 2 = 12 + 1;
- 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.
830 828(10) = 1100 1010 1101 0110 1100(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 20.
- 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, 20,
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 830 828(10) converted to signed binary in one's complement representation: