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;
- 1 947 074 670 ÷ 2 = 973 537 335 + 0;
- 973 537 335 ÷ 2 = 486 768 667 + 1;
- 486 768 667 ÷ 2 = 243 384 333 + 1;
- 243 384 333 ÷ 2 = 121 692 166 + 1;
- 121 692 166 ÷ 2 = 60 846 083 + 0;
- 60 846 083 ÷ 2 = 30 423 041 + 1;
- 30 423 041 ÷ 2 = 15 211 520 + 1;
- 15 211 520 ÷ 2 = 7 605 760 + 0;
- 7 605 760 ÷ 2 = 3 802 880 + 0;
- 3 802 880 ÷ 2 = 1 901 440 + 0;
- 1 901 440 ÷ 2 = 950 720 + 0;
- 950 720 ÷ 2 = 475 360 + 0;
- 475 360 ÷ 2 = 237 680 + 0;
- 237 680 ÷ 2 = 118 840 + 0;
- 118 840 ÷ 2 = 59 420 + 0;
- 59 420 ÷ 2 = 29 710 + 0;
- 29 710 ÷ 2 = 14 855 + 0;
- 14 855 ÷ 2 = 7 427 + 1;
- 7 427 ÷ 2 = 3 713 + 1;
- 3 713 ÷ 2 = 1 856 + 1;
- 1 856 ÷ 2 = 928 + 0;
- 928 ÷ 2 = 464 + 0;
- 464 ÷ 2 = 232 + 0;
- 232 ÷ 2 = 116 + 0;
- 116 ÷ 2 = 58 + 0;
- 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.
1 947 074 670(10) = 111 0100 0000 1110 0000 0000 0110 1110(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 31.
- 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, 31,
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.
Decimal Number 1 947 074 670(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.