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;
- 66 766 613 ÷ 2 = 33 383 306 + 1;
- 33 383 306 ÷ 2 = 16 691 653 + 0;
- 16 691 653 ÷ 2 = 8 345 826 + 1;
- 8 345 826 ÷ 2 = 4 172 913 + 0;
- 4 172 913 ÷ 2 = 2 086 456 + 1;
- 2 086 456 ÷ 2 = 1 043 228 + 0;
- 1 043 228 ÷ 2 = 521 614 + 0;
- 521 614 ÷ 2 = 260 807 + 0;
- 260 807 ÷ 2 = 130 403 + 1;
- 130 403 ÷ 2 = 65 201 + 1;
- 65 201 ÷ 2 = 32 600 + 1;
- 32 600 ÷ 2 = 16 300 + 0;
- 16 300 ÷ 2 = 8 150 + 0;
- 8 150 ÷ 2 = 4 075 + 0;
- 4 075 ÷ 2 = 2 037 + 1;
- 2 037 ÷ 2 = 1 018 + 1;
- 1 018 ÷ 2 = 509 + 0;
- 509 ÷ 2 = 254 + 1;
- 254 ÷ 2 = 127 + 0;
- 127 ÷ 2 = 63 + 1;
- 63 ÷ 2 = 31 + 1;
- 31 ÷ 2 = 15 + 1;
- 15 ÷ 2 = 7 + 1;
- 7 ÷ 2 = 3 + 1;
- 3 ÷ 2 = 1 + 1;
- 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.
66 766 613(10) = 11 1111 1010 1100 0111 0001 0101(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 26.
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, 26,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 32.
4. Get the positive binary computer representation on 32 bits (4 Bytes):
If needed, add extra 0s in front (to the left) of the base 2 number, up to the required length, 32.
Number 66 766 613(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:
66 766 613(10) = 0000 0011 1111 1010 1100 0111 0001 0101
Spaces were used to group digits: for binary, by 4, for decimal, by 3.