1. Divide the number repeatedly by 2:
Keep track of each remainder.
We stop when we get a quotient that is equal to zero.
- division = quotient + remainder;
- 65 164 492 ÷ 2 = 32 582 246 + 0;
- 32 582 246 ÷ 2 = 16 291 123 + 0;
- 16 291 123 ÷ 2 = 8 145 561 + 1;
- 8 145 561 ÷ 2 = 4 072 780 + 1;
- 4 072 780 ÷ 2 = 2 036 390 + 0;
- 2 036 390 ÷ 2 = 1 018 195 + 0;
- 1 018 195 ÷ 2 = 509 097 + 1;
- 509 097 ÷ 2 = 254 548 + 1;
- 254 548 ÷ 2 = 127 274 + 0;
- 127 274 ÷ 2 = 63 637 + 0;
- 63 637 ÷ 2 = 31 818 + 1;
- 31 818 ÷ 2 = 15 909 + 0;
- 15 909 ÷ 2 = 7 954 + 1;
- 7 954 ÷ 2 = 3 977 + 0;
- 3 977 ÷ 2 = 1 988 + 1;
- 1 988 ÷ 2 = 994 + 0;
- 994 ÷ 2 = 497 + 0;
- 497 ÷ 2 = 248 + 1;
- 248 ÷ 2 = 124 + 0;
- 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;
2. Construct the base 2 representation of the positive number:
Take all the remainders starting from the bottom of the list constructed above.
65 164 492(10) = 11 1110 0010 0101 0100 1100 1100(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 26.
- 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, 26,
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 65 164 492(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.