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 471 804 783 ÷ 2 = 1 735 902 391 + 1;
- 1 735 902 391 ÷ 2 = 867 951 195 + 1;
- 867 951 195 ÷ 2 = 433 975 597 + 1;
- 433 975 597 ÷ 2 = 216 987 798 + 1;
- 216 987 798 ÷ 2 = 108 493 899 + 0;
- 108 493 899 ÷ 2 = 54 246 949 + 1;
- 54 246 949 ÷ 2 = 27 123 474 + 1;
- 27 123 474 ÷ 2 = 13 561 737 + 0;
- 13 561 737 ÷ 2 = 6 780 868 + 1;
- 6 780 868 ÷ 2 = 3 390 434 + 0;
- 3 390 434 ÷ 2 = 1 695 217 + 0;
- 1 695 217 ÷ 2 = 847 608 + 1;
- 847 608 ÷ 2 = 423 804 + 0;
- 423 804 ÷ 2 = 211 902 + 0;
- 211 902 ÷ 2 = 105 951 + 0;
- 105 951 ÷ 2 = 52 975 + 1;
- 52 975 ÷ 2 = 26 487 + 1;
- 26 487 ÷ 2 = 13 243 + 1;
- 13 243 ÷ 2 = 6 621 + 1;
- 6 621 ÷ 2 = 3 310 + 1;
- 3 310 ÷ 2 = 1 655 + 0;
- 1 655 ÷ 2 = 827 + 1;
- 827 ÷ 2 = 413 + 1;
- 413 ÷ 2 = 206 + 1;
- 206 ÷ 2 = 103 + 0;
- 103 ÷ 2 = 51 + 1;
- 51 ÷ 2 = 25 + 1;
- 25 ÷ 2 = 12 + 1;
- 12 ÷ 2 = 6 + 0;
- 6 ÷ 2 = 3 + 0;
- 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 471 804 783(10) = 1100 1110 1110 1111 1000 1001 0110 1111(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 471 804 783(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.