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;
- 87 160 001 121 ÷ 2 = 43 580 000 560 + 1;
- 43 580 000 560 ÷ 2 = 21 790 000 280 + 0;
- 21 790 000 280 ÷ 2 = 10 895 000 140 + 0;
- 10 895 000 140 ÷ 2 = 5 447 500 070 + 0;
- 5 447 500 070 ÷ 2 = 2 723 750 035 + 0;
- 2 723 750 035 ÷ 2 = 1 361 875 017 + 1;
- 1 361 875 017 ÷ 2 = 680 937 508 + 1;
- 680 937 508 ÷ 2 = 340 468 754 + 0;
- 340 468 754 ÷ 2 = 170 234 377 + 0;
- 170 234 377 ÷ 2 = 85 117 188 + 1;
- 85 117 188 ÷ 2 = 42 558 594 + 0;
- 42 558 594 ÷ 2 = 21 279 297 + 0;
- 21 279 297 ÷ 2 = 10 639 648 + 1;
- 10 639 648 ÷ 2 = 5 319 824 + 0;
- 5 319 824 ÷ 2 = 2 659 912 + 0;
- 2 659 912 ÷ 2 = 1 329 956 + 0;
- 1 329 956 ÷ 2 = 664 978 + 0;
- 664 978 ÷ 2 = 332 489 + 0;
- 332 489 ÷ 2 = 166 244 + 1;
- 166 244 ÷ 2 = 83 122 + 0;
- 83 122 ÷ 2 = 41 561 + 0;
- 41 561 ÷ 2 = 20 780 + 1;
- 20 780 ÷ 2 = 10 390 + 0;
- 10 390 ÷ 2 = 5 195 + 0;
- 5 195 ÷ 2 = 2 597 + 1;
- 2 597 ÷ 2 = 1 298 + 1;
- 1 298 ÷ 2 = 649 + 0;
- 649 ÷ 2 = 324 + 1;
- 324 ÷ 2 = 162 + 0;
- 162 ÷ 2 = 81 + 0;
- 81 ÷ 2 = 40 + 1;
- 40 ÷ 2 = 20 + 0;
- 20 ÷ 2 = 10 + 0;
- 10 ÷ 2 = 5 + 0;
- 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.
87 160 001 121(10) = 1 0100 0100 1011 0010 0100 0001 0010 0110 0001(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 37.
- 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, 37,
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 87 160 001 121(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.