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;
- 23 343 508 ÷ 2 = 11 671 754 + 0;
- 11 671 754 ÷ 2 = 5 835 877 + 0;
- 5 835 877 ÷ 2 = 2 917 938 + 1;
- 2 917 938 ÷ 2 = 1 458 969 + 0;
- 1 458 969 ÷ 2 = 729 484 + 1;
- 729 484 ÷ 2 = 364 742 + 0;
- 364 742 ÷ 2 = 182 371 + 0;
- 182 371 ÷ 2 = 91 185 + 1;
- 91 185 ÷ 2 = 45 592 + 1;
- 45 592 ÷ 2 = 22 796 + 0;
- 22 796 ÷ 2 = 11 398 + 0;
- 11 398 ÷ 2 = 5 699 + 0;
- 5 699 ÷ 2 = 2 849 + 1;
- 2 849 ÷ 2 = 1 424 + 1;
- 1 424 ÷ 2 = 712 + 0;
- 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.
23 343 508(10) = 1 0110 0100 0011 0001 1001 0100(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 23 343 508(10) converted to signed binary in one's complement representation: