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;
- 3 221 225 377 ÷ 2 = 1 610 612 688 + 1;
- 1 610 612 688 ÷ 2 = 805 306 344 + 0;
- 805 306 344 ÷ 2 = 402 653 172 + 0;
- 402 653 172 ÷ 2 = 201 326 586 + 0;
- 201 326 586 ÷ 2 = 100 663 293 + 0;
- 100 663 293 ÷ 2 = 50 331 646 + 1;
- 50 331 646 ÷ 2 = 25 165 823 + 0;
- 25 165 823 ÷ 2 = 12 582 911 + 1;
- 12 582 911 ÷ 2 = 6 291 455 + 1;
- 6 291 455 ÷ 2 = 3 145 727 + 1;
- 3 145 727 ÷ 2 = 1 572 863 + 1;
- 1 572 863 ÷ 2 = 786 431 + 1;
- 786 431 ÷ 2 = 393 215 + 1;
- 393 215 ÷ 2 = 196 607 + 1;
- 196 607 ÷ 2 = 98 303 + 1;
- 98 303 ÷ 2 = 49 151 + 1;
- 49 151 ÷ 2 = 24 575 + 1;
- 24 575 ÷ 2 = 12 287 + 1;
- 12 287 ÷ 2 = 6 143 + 1;
- 6 143 ÷ 2 = 3 071 + 1;
- 3 071 ÷ 2 = 1 535 + 1;
- 1 535 ÷ 2 = 767 + 1;
- 767 ÷ 2 = 383 + 1;
- 383 ÷ 2 = 191 + 1;
- 191 ÷ 2 = 95 + 1;
- 95 ÷ 2 = 47 + 1;
- 47 ÷ 2 = 23 + 1;
- 23 ÷ 2 = 11 + 1;
- 11 ÷ 2 = 5 + 1;
- 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.
3 221 225 377(10) = 1011 1111 1111 1111 1111 1111 1010 0001(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.
Number 3 221 225 377(10), a signed integer number (with sign), converted from decimal system (from base 10) and written as a signed binary in two's complement representation:
3 221 225 377(10) = 0000 0000 0000 0000 0000 0000 0000 0000 1011 1111 1111 1111 1111 1111 1010 0001
Spaces were used to group digits: for binary, by 4, for decimal, by 3.