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;
- 96 670 618 ÷ 2 = 48 335 309 + 0;
- 48 335 309 ÷ 2 = 24 167 654 + 1;
- 24 167 654 ÷ 2 = 12 083 827 + 0;
- 12 083 827 ÷ 2 = 6 041 913 + 1;
- 6 041 913 ÷ 2 = 3 020 956 + 1;
- 3 020 956 ÷ 2 = 1 510 478 + 0;
- 1 510 478 ÷ 2 = 755 239 + 0;
- 755 239 ÷ 2 = 377 619 + 1;
- 377 619 ÷ 2 = 188 809 + 1;
- 188 809 ÷ 2 = 94 404 + 1;
- 94 404 ÷ 2 = 47 202 + 0;
- 47 202 ÷ 2 = 23 601 + 0;
- 23 601 ÷ 2 = 11 800 + 1;
- 11 800 ÷ 2 = 5 900 + 0;
- 5 900 ÷ 2 = 2 950 + 0;
- 2 950 ÷ 2 = 1 475 + 0;
- 1 475 ÷ 2 = 737 + 1;
- 737 ÷ 2 = 368 + 1;
- 368 ÷ 2 = 184 + 0;
- 184 ÷ 2 = 92 + 0;
- 92 ÷ 2 = 46 + 0;
- 46 ÷ 2 = 23 + 0;
- 23 ÷ 2 = 11 + 1;
- 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.
96 670 618(10) = 101 1100 0011 0001 0011 1001 1010(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 27.
- 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, 27,
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 96 670 618(10) converted to signed binary in one's complement representation: