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;
- 61 745 680 ÷ 2 = 30 872 840 + 0;
- 30 872 840 ÷ 2 = 15 436 420 + 0;
- 15 436 420 ÷ 2 = 7 718 210 + 0;
- 7 718 210 ÷ 2 = 3 859 105 + 0;
- 3 859 105 ÷ 2 = 1 929 552 + 1;
- 1 929 552 ÷ 2 = 964 776 + 0;
- 964 776 ÷ 2 = 482 388 + 0;
- 482 388 ÷ 2 = 241 194 + 0;
- 241 194 ÷ 2 = 120 597 + 0;
- 120 597 ÷ 2 = 60 298 + 1;
- 60 298 ÷ 2 = 30 149 + 0;
- 30 149 ÷ 2 = 15 074 + 1;
- 15 074 ÷ 2 = 7 537 + 0;
- 7 537 ÷ 2 = 3 768 + 1;
- 3 768 ÷ 2 = 1 884 + 0;
- 1 884 ÷ 2 = 942 + 0;
- 942 ÷ 2 = 471 + 0;
- 471 ÷ 2 = 235 + 1;
- 235 ÷ 2 = 117 + 1;
- 117 ÷ 2 = 58 + 1;
- 58 ÷ 2 = 29 + 0;
- 29 ÷ 2 = 14 + 1;
- 14 ÷ 2 = 7 + 0;
- 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.
61 745 680(10) = 11 1010 1110 0010 1010 0001 0000(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 61 745 680(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.