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;
- 1 172 968 275 586 ÷ 2 = 586 484 137 793 + 0;
- 586 484 137 793 ÷ 2 = 293 242 068 896 + 1;
- 293 242 068 896 ÷ 2 = 146 621 034 448 + 0;
- 146 621 034 448 ÷ 2 = 73 310 517 224 + 0;
- 73 310 517 224 ÷ 2 = 36 655 258 612 + 0;
- 36 655 258 612 ÷ 2 = 18 327 629 306 + 0;
- 18 327 629 306 ÷ 2 = 9 163 814 653 + 0;
- 9 163 814 653 ÷ 2 = 4 581 907 326 + 1;
- 4 581 907 326 ÷ 2 = 2 290 953 663 + 0;
- 2 290 953 663 ÷ 2 = 1 145 476 831 + 1;
- 1 145 476 831 ÷ 2 = 572 738 415 + 1;
- 572 738 415 ÷ 2 = 286 369 207 + 1;
- 286 369 207 ÷ 2 = 143 184 603 + 1;
- 143 184 603 ÷ 2 = 71 592 301 + 1;
- 71 592 301 ÷ 2 = 35 796 150 + 1;
- 35 796 150 ÷ 2 = 17 898 075 + 0;
- 17 898 075 ÷ 2 = 8 949 037 + 1;
- 8 949 037 ÷ 2 = 4 474 518 + 1;
- 4 474 518 ÷ 2 = 2 237 259 + 0;
- 2 237 259 ÷ 2 = 1 118 629 + 1;
- 1 118 629 ÷ 2 = 559 314 + 1;
- 559 314 ÷ 2 = 279 657 + 0;
- 279 657 ÷ 2 = 139 828 + 1;
- 139 828 ÷ 2 = 69 914 + 0;
- 69 914 ÷ 2 = 34 957 + 0;
- 34 957 ÷ 2 = 17 478 + 1;
- 17 478 ÷ 2 = 8 739 + 0;
- 8 739 ÷ 2 = 4 369 + 1;
- 4 369 ÷ 2 = 2 184 + 1;
- 2 184 ÷ 2 = 1 092 + 0;
- 1 092 ÷ 2 = 546 + 0;
- 546 ÷ 2 = 273 + 0;
- 273 ÷ 2 = 136 + 1;
- 136 ÷ 2 = 68 + 0;
- 68 ÷ 2 = 34 + 0;
- 34 ÷ 2 = 17 + 0;
- 17 ÷ 2 = 8 + 1;
- 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.
1 172 968 275 586(10) = 1 0001 0001 0001 1010 0101 1011 0111 1110 1000 0010(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 41.
- 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, 41,
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 1 172 968 275 586(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.