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;
- 19 070 744 ÷ 2 = 9 535 372 + 0;
- 9 535 372 ÷ 2 = 4 767 686 + 0;
- 4 767 686 ÷ 2 = 2 383 843 + 0;
- 2 383 843 ÷ 2 = 1 191 921 + 1;
- 1 191 921 ÷ 2 = 595 960 + 1;
- 595 960 ÷ 2 = 297 980 + 0;
- 297 980 ÷ 2 = 148 990 + 0;
- 148 990 ÷ 2 = 74 495 + 0;
- 74 495 ÷ 2 = 37 247 + 1;
- 37 247 ÷ 2 = 18 623 + 1;
- 18 623 ÷ 2 = 9 311 + 1;
- 9 311 ÷ 2 = 4 655 + 1;
- 4 655 ÷ 2 = 2 327 + 1;
- 2 327 ÷ 2 = 1 163 + 1;
- 1 163 ÷ 2 = 581 + 1;
- 581 ÷ 2 = 290 + 1;
- 290 ÷ 2 = 145 + 0;
- 145 ÷ 2 = 72 + 1;
- 72 ÷ 2 = 36 + 0;
- 36 ÷ 2 = 18 + 0;
- 18 ÷ 2 = 9 + 0;
- 9 ÷ 2 = 4 + 1;
- 4 ÷ 2 = 2 + 0;
- 2 ÷ 2 = 1 + 0;
- 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.
19 070 744(10) = 1 0010 0010 1111 1111 0001 1000(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 25.
- 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, 25,
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 19 070 744(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.