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;
- 4 324 020 245 ÷ 2 = 2 162 010 122 + 1;
- 2 162 010 122 ÷ 2 = 1 081 005 061 + 0;
- 1 081 005 061 ÷ 2 = 540 502 530 + 1;
- 540 502 530 ÷ 2 = 270 251 265 + 0;
- 270 251 265 ÷ 2 = 135 125 632 + 1;
- 135 125 632 ÷ 2 = 67 562 816 + 0;
- 67 562 816 ÷ 2 = 33 781 408 + 0;
- 33 781 408 ÷ 2 = 16 890 704 + 0;
- 16 890 704 ÷ 2 = 8 445 352 + 0;
- 8 445 352 ÷ 2 = 4 222 676 + 0;
- 4 222 676 ÷ 2 = 2 111 338 + 0;
- 2 111 338 ÷ 2 = 1 055 669 + 0;
- 1 055 669 ÷ 2 = 527 834 + 1;
- 527 834 ÷ 2 = 263 917 + 0;
- 263 917 ÷ 2 = 131 958 + 1;
- 131 958 ÷ 2 = 65 979 + 0;
- 65 979 ÷ 2 = 32 989 + 1;
- 32 989 ÷ 2 = 16 494 + 1;
- 16 494 ÷ 2 = 8 247 + 0;
- 8 247 ÷ 2 = 4 123 + 1;
- 4 123 ÷ 2 = 2 061 + 1;
- 2 061 ÷ 2 = 1 030 + 1;
- 1 030 ÷ 2 = 515 + 0;
- 515 ÷ 2 = 257 + 1;
- 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.
4 324 020 245(10) = 1 0000 0001 1011 1011 0101 0000 0001 0101(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 33.
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) is reserved for 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, 33,
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 4 324 020 245(10), a signed integer number (with sign),
converted from decimal system (from base 10)
and written as a signed binary (in base 2):
4 324 020 245(10) = 0000 0000 0000 0000 0000 0000 0000 0001 0000 0001 1011 1011 0101 0000 0001 0101
Spaces were used to group digits: for binary, by 4, for decimal, by 3.