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 294 822 393 ÷ 2 = 1 647 411 196 + 1;
- 1 647 411 196 ÷ 2 = 823 705 598 + 0;
- 823 705 598 ÷ 2 = 411 852 799 + 0;
- 411 852 799 ÷ 2 = 205 926 399 + 1;
- 205 926 399 ÷ 2 = 102 963 199 + 1;
- 102 963 199 ÷ 2 = 51 481 599 + 1;
- 51 481 599 ÷ 2 = 25 740 799 + 1;
- 25 740 799 ÷ 2 = 12 870 399 + 1;
- 12 870 399 ÷ 2 = 6 435 199 + 1;
- 6 435 199 ÷ 2 = 3 217 599 + 1;
- 3 217 599 ÷ 2 = 1 608 799 + 1;
- 1 608 799 ÷ 2 = 804 399 + 1;
- 804 399 ÷ 2 = 402 199 + 1;
- 402 199 ÷ 2 = 201 099 + 1;
- 201 099 ÷ 2 = 100 549 + 1;
- 100 549 ÷ 2 = 50 274 + 1;
- 50 274 ÷ 2 = 25 137 + 0;
- 25 137 ÷ 2 = 12 568 + 1;
- 12 568 ÷ 2 = 6 284 + 0;
- 6 284 ÷ 2 = 3 142 + 0;
- 3 142 ÷ 2 = 1 571 + 0;
- 1 571 ÷ 2 = 785 + 1;
- 785 ÷ 2 = 392 + 1;
- 392 ÷ 2 = 196 + 0;
- 196 ÷ 2 = 98 + 0;
- 98 ÷ 2 = 49 + 0;
- 49 ÷ 2 = 24 + 1;
- 24 ÷ 2 = 12 + 0;
- 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 294 822 393(10) = 1100 0100 0110 0010 1111 1111 1111 1001(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 294 822 393(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.