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;
- 163 430 014 ÷ 2 = 81 715 007 + 0;
- 81 715 007 ÷ 2 = 40 857 503 + 1;
- 40 857 503 ÷ 2 = 20 428 751 + 1;
- 20 428 751 ÷ 2 = 10 214 375 + 1;
- 10 214 375 ÷ 2 = 5 107 187 + 1;
- 5 107 187 ÷ 2 = 2 553 593 + 1;
- 2 553 593 ÷ 2 = 1 276 796 + 1;
- 1 276 796 ÷ 2 = 638 398 + 0;
- 638 398 ÷ 2 = 319 199 + 0;
- 319 199 ÷ 2 = 159 599 + 1;
- 159 599 ÷ 2 = 79 799 + 1;
- 79 799 ÷ 2 = 39 899 + 1;
- 39 899 ÷ 2 = 19 949 + 1;
- 19 949 ÷ 2 = 9 974 + 1;
- 9 974 ÷ 2 = 4 987 + 0;
- 4 987 ÷ 2 = 2 493 + 1;
- 2 493 ÷ 2 = 1 246 + 1;
- 1 246 ÷ 2 = 623 + 0;
- 623 ÷ 2 = 311 + 1;
- 311 ÷ 2 = 155 + 1;
- 155 ÷ 2 = 77 + 1;
- 77 ÷ 2 = 38 + 1;
- 38 ÷ 2 = 19 + 0;
- 19 ÷ 2 = 9 + 1;
- 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.
163 430 014(10) = 1001 1011 1101 1011 1110 0111 1110(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 28.
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, 28,
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 163 430 014(10), a signed integer number (with sign), converted from decimal system (from base 10) and written as a signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.