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;
- 747 324 382 ÷ 2 = 373 662 191 + 0;
- 373 662 191 ÷ 2 = 186 831 095 + 1;
- 186 831 095 ÷ 2 = 93 415 547 + 1;
- 93 415 547 ÷ 2 = 46 707 773 + 1;
- 46 707 773 ÷ 2 = 23 353 886 + 1;
- 23 353 886 ÷ 2 = 11 676 943 + 0;
- 11 676 943 ÷ 2 = 5 838 471 + 1;
- 5 838 471 ÷ 2 = 2 919 235 + 1;
- 2 919 235 ÷ 2 = 1 459 617 + 1;
- 1 459 617 ÷ 2 = 729 808 + 1;
- 729 808 ÷ 2 = 364 904 + 0;
- 364 904 ÷ 2 = 182 452 + 0;
- 182 452 ÷ 2 = 91 226 + 0;
- 91 226 ÷ 2 = 45 613 + 0;
- 45 613 ÷ 2 = 22 806 + 1;
- 22 806 ÷ 2 = 11 403 + 0;
- 11 403 ÷ 2 = 5 701 + 1;
- 5 701 ÷ 2 = 2 850 + 1;
- 2 850 ÷ 2 = 1 425 + 0;
- 1 425 ÷ 2 = 712 + 1;
- 712 ÷ 2 = 356 + 0;
- 356 ÷ 2 = 178 + 0;
- 178 ÷ 2 = 89 + 0;
- 89 ÷ 2 = 44 + 1;
- 44 ÷ 2 = 22 + 0;
- 22 ÷ 2 = 11 + 0;
- 11 ÷ 2 = 5 + 1;
- 5 ÷ 2 = 2 + 1;
- 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.
747 324 382(10) = 10 1100 1000 1011 0100 0011 1101 1110(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 30.
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) is reserved for 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, 30,
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 747 324 382(10), a signed integer number (with sign),
converted from decimal system (from base 10)
and written as a signed binary (in base 2):
747 324 382(10) = 0010 1100 1000 1011 0100 0011 1101 1110
Spaces were used to group digits: for binary, by 4, for decimal, by 3.