1. Divide the number repeatedly by 2:
Keep track of each remainder.
Stop when you get a quotient that is equal to zero.
- division = quotient + remainder;
- 19 102 174 ÷ 2 = 9 551 087 + 0;
- 9 551 087 ÷ 2 = 4 775 543 + 1;
- 4 775 543 ÷ 2 = 2 387 771 + 1;
- 2 387 771 ÷ 2 = 1 193 885 + 1;
- 1 193 885 ÷ 2 = 596 942 + 1;
- 596 942 ÷ 2 = 298 471 + 0;
- 298 471 ÷ 2 = 149 235 + 1;
- 149 235 ÷ 2 = 74 617 + 1;
- 74 617 ÷ 2 = 37 308 + 1;
- 37 308 ÷ 2 = 18 654 + 0;
- 18 654 ÷ 2 = 9 327 + 0;
- 9 327 ÷ 2 = 4 663 + 1;
- 4 663 ÷ 2 = 2 331 + 1;
- 2 331 ÷ 2 = 1 165 + 1;
- 1 165 ÷ 2 = 582 + 1;
- 582 ÷ 2 = 291 + 0;
- 291 ÷ 2 = 145 + 1;
- 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 102 174(10) = 1 0010 0011 0111 1001 1101 1110(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.
Number 19 102 174(10), a signed integer number (with sign), converted from decimal system (from base 10) and written as a signed binary in one's complement representation: