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;
- 9 090 908 775 ÷ 2 = 4 545 454 387 + 1;
- 4 545 454 387 ÷ 2 = 2 272 727 193 + 1;
- 2 272 727 193 ÷ 2 = 1 136 363 596 + 1;
- 1 136 363 596 ÷ 2 = 568 181 798 + 0;
- 568 181 798 ÷ 2 = 284 090 899 + 0;
- 284 090 899 ÷ 2 = 142 045 449 + 1;
- 142 045 449 ÷ 2 = 71 022 724 + 1;
- 71 022 724 ÷ 2 = 35 511 362 + 0;
- 35 511 362 ÷ 2 = 17 755 681 + 0;
- 17 755 681 ÷ 2 = 8 877 840 + 1;
- 8 877 840 ÷ 2 = 4 438 920 + 0;
- 4 438 920 ÷ 2 = 2 219 460 + 0;
- 2 219 460 ÷ 2 = 1 109 730 + 0;
- 1 109 730 ÷ 2 = 554 865 + 0;
- 554 865 ÷ 2 = 277 432 + 1;
- 277 432 ÷ 2 = 138 716 + 0;
- 138 716 ÷ 2 = 69 358 + 0;
- 69 358 ÷ 2 = 34 679 + 0;
- 34 679 ÷ 2 = 17 339 + 1;
- 17 339 ÷ 2 = 8 669 + 1;
- 8 669 ÷ 2 = 4 334 + 1;
- 4 334 ÷ 2 = 2 167 + 0;
- 2 167 ÷ 2 = 1 083 + 1;
- 1 083 ÷ 2 = 541 + 1;
- 541 ÷ 2 = 270 + 1;
- 270 ÷ 2 = 135 + 0;
- 135 ÷ 2 = 67 + 1;
- 67 ÷ 2 = 33 + 1;
- 33 ÷ 2 = 16 + 1;
- 16 ÷ 2 = 8 + 0;
- 8 ÷ 2 = 4 + 0;
- 4 ÷ 2 = 2 + 0;
- 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.
9 090 908 775(10) = 10 0001 1101 1101 1100 0100 0010 0110 0111(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 34.
- 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, 34,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 64.
4. Get the positive binary computer representation on 64 bits (8 Bytes):
If needed, add extra 0s in front (to the left) of the base 2 number, up to the required length, 64.
Decimal Number 9 090 908 775(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.