1. Divide the number repeatedly by 2:
Keep track of each remainder.
Stop when you get a quotient that is equal to zero.
- division = quotient + remainder;
- 2 157 529 056 ÷ 2 = 1 078 764 528 + 0;
- 1 078 764 528 ÷ 2 = 539 382 264 + 0;
- 539 382 264 ÷ 2 = 269 691 132 + 0;
- 269 691 132 ÷ 2 = 134 845 566 + 0;
- 134 845 566 ÷ 2 = 67 422 783 + 0;
- 67 422 783 ÷ 2 = 33 711 391 + 1;
- 33 711 391 ÷ 2 = 16 855 695 + 1;
- 16 855 695 ÷ 2 = 8 427 847 + 1;
- 8 427 847 ÷ 2 = 4 213 923 + 1;
- 4 213 923 ÷ 2 = 2 106 961 + 1;
- 2 106 961 ÷ 2 = 1 053 480 + 1;
- 1 053 480 ÷ 2 = 526 740 + 0;
- 526 740 ÷ 2 = 263 370 + 0;
- 263 370 ÷ 2 = 131 685 + 0;
- 131 685 ÷ 2 = 65 842 + 1;
- 65 842 ÷ 2 = 32 921 + 0;
- 32 921 ÷ 2 = 16 460 + 1;
- 16 460 ÷ 2 = 8 230 + 0;
- 8 230 ÷ 2 = 4 115 + 0;
- 4 115 ÷ 2 = 2 057 + 1;
- 2 057 ÷ 2 = 1 028 + 1;
- 1 028 ÷ 2 = 514 + 0;
- 514 ÷ 2 = 257 + 0;
- 257 ÷ 2 = 128 + 1;
- 128 ÷ 2 = 64 + 0;
- 64 ÷ 2 = 32 + 0;
- 32 ÷ 2 = 16 + 0;
- 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.
2 157 529 056(10) = 1000 0000 1001 1001 0100 0111 1110 0000(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 32.
- 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, 32,
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 2 157 529 056(10) converted to signed binary in one's complement representation: