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 937 976 765 ÷ 2 = 1 968 988 382 + 1;
- 1 968 988 382 ÷ 2 = 984 494 191 + 0;
- 984 494 191 ÷ 2 = 492 247 095 + 1;
- 492 247 095 ÷ 2 = 246 123 547 + 1;
- 246 123 547 ÷ 2 = 123 061 773 + 1;
- 123 061 773 ÷ 2 = 61 530 886 + 1;
- 61 530 886 ÷ 2 = 30 765 443 + 0;
- 30 765 443 ÷ 2 = 15 382 721 + 1;
- 15 382 721 ÷ 2 = 7 691 360 + 1;
- 7 691 360 ÷ 2 = 3 845 680 + 0;
- 3 845 680 ÷ 2 = 1 922 840 + 0;
- 1 922 840 ÷ 2 = 961 420 + 0;
- 961 420 ÷ 2 = 480 710 + 0;
- 480 710 ÷ 2 = 240 355 + 0;
- 240 355 ÷ 2 = 120 177 + 1;
- 120 177 ÷ 2 = 60 088 + 1;
- 60 088 ÷ 2 = 30 044 + 0;
- 30 044 ÷ 2 = 15 022 + 0;
- 15 022 ÷ 2 = 7 511 + 0;
- 7 511 ÷ 2 = 3 755 + 1;
- 3 755 ÷ 2 = 1 877 + 1;
- 1 877 ÷ 2 = 938 + 1;
- 938 ÷ 2 = 469 + 0;
- 469 ÷ 2 = 234 + 1;
- 234 ÷ 2 = 117 + 0;
- 117 ÷ 2 = 58 + 1;
- 58 ÷ 2 = 29 + 0;
- 29 ÷ 2 = 14 + 1;
- 14 ÷ 2 = 7 + 0;
- 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.
3 937 976 765(10) = 1110 1010 1011 1000 1100 0001 1011 1101(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 3 937 976 765(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.