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;
- 2 100 261 104 ÷ 2 = 1 050 130 552 + 0;
- 1 050 130 552 ÷ 2 = 525 065 276 + 0;
- 525 065 276 ÷ 2 = 262 532 638 + 0;
- 262 532 638 ÷ 2 = 131 266 319 + 0;
- 131 266 319 ÷ 2 = 65 633 159 + 1;
- 65 633 159 ÷ 2 = 32 816 579 + 1;
- 32 816 579 ÷ 2 = 16 408 289 + 1;
- 16 408 289 ÷ 2 = 8 204 144 + 1;
- 8 204 144 ÷ 2 = 4 102 072 + 0;
- 4 102 072 ÷ 2 = 2 051 036 + 0;
- 2 051 036 ÷ 2 = 1 025 518 + 0;
- 1 025 518 ÷ 2 = 512 759 + 0;
- 512 759 ÷ 2 = 256 379 + 1;
- 256 379 ÷ 2 = 128 189 + 1;
- 128 189 ÷ 2 = 64 094 + 1;
- 64 094 ÷ 2 = 32 047 + 0;
- 32 047 ÷ 2 = 16 023 + 1;
- 16 023 ÷ 2 = 8 011 + 1;
- 8 011 ÷ 2 = 4 005 + 1;
- 4 005 ÷ 2 = 2 002 + 1;
- 2 002 ÷ 2 = 1 001 + 0;
- 1 001 ÷ 2 = 500 + 1;
- 500 ÷ 2 = 250 + 0;
- 250 ÷ 2 = 125 + 0;
- 125 ÷ 2 = 62 + 1;
- 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.
2 100 261 104(10) = 111 1101 0010 1111 0111 0000 1111 0000(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 31.
- 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, 31,
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 2 100 261 104(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.