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;
- 627 726 708 ÷ 2 = 313 863 354 + 0;
- 313 863 354 ÷ 2 = 156 931 677 + 0;
- 156 931 677 ÷ 2 = 78 465 838 + 1;
- 78 465 838 ÷ 2 = 39 232 919 + 0;
- 39 232 919 ÷ 2 = 19 616 459 + 1;
- 19 616 459 ÷ 2 = 9 808 229 + 1;
- 9 808 229 ÷ 2 = 4 904 114 + 1;
- 4 904 114 ÷ 2 = 2 452 057 + 0;
- 2 452 057 ÷ 2 = 1 226 028 + 1;
- 1 226 028 ÷ 2 = 613 014 + 0;
- 613 014 ÷ 2 = 306 507 + 0;
- 306 507 ÷ 2 = 153 253 + 1;
- 153 253 ÷ 2 = 76 626 + 1;
- 76 626 ÷ 2 = 38 313 + 0;
- 38 313 ÷ 2 = 19 156 + 1;
- 19 156 ÷ 2 = 9 578 + 0;
- 9 578 ÷ 2 = 4 789 + 0;
- 4 789 ÷ 2 = 2 394 + 1;
- 2 394 ÷ 2 = 1 197 + 0;
- 1 197 ÷ 2 = 598 + 1;
- 598 ÷ 2 = 299 + 0;
- 299 ÷ 2 = 149 + 1;
- 149 ÷ 2 = 74 + 1;
- 74 ÷ 2 = 37 + 0;
- 37 ÷ 2 = 18 + 1;
- 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.
627 726 708(10) = 10 0101 0110 1010 0101 1001 0111 0100(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) 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, 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.
Decimal Number 627 726 708(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.