What are the required steps to convert base 10 integer
number 742 086 384 to signed binary code (in base 2)?
- A signed integer, written in base ten, or a decimal system number, is a number written using the digits 0 through 9 and the sign, which can be positive (+) or negative (-). If positive, the sign is usually not written. A number written in base two, or binary, is a number written using only the digits 0 and 1.
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;
- 742 086 384 ÷ 2 = 371 043 192 + 0;
- 371 043 192 ÷ 2 = 185 521 596 + 0;
- 185 521 596 ÷ 2 = 92 760 798 + 0;
- 92 760 798 ÷ 2 = 46 380 399 + 0;
- 46 380 399 ÷ 2 = 23 190 199 + 1;
- 23 190 199 ÷ 2 = 11 595 099 + 1;
- 11 595 099 ÷ 2 = 5 797 549 + 1;
- 5 797 549 ÷ 2 = 2 898 774 + 1;
- 2 898 774 ÷ 2 = 1 449 387 + 0;
- 1 449 387 ÷ 2 = 724 693 + 1;
- 724 693 ÷ 2 = 362 346 + 1;
- 362 346 ÷ 2 = 181 173 + 0;
- 181 173 ÷ 2 = 90 586 + 1;
- 90 586 ÷ 2 = 45 293 + 0;
- 45 293 ÷ 2 = 22 646 + 1;
- 22 646 ÷ 2 = 11 323 + 0;
- 11 323 ÷ 2 = 5 661 + 1;
- 5 661 ÷ 2 = 2 830 + 1;
- 2 830 ÷ 2 = 1 415 + 0;
- 1 415 ÷ 2 = 707 + 1;
- 707 ÷ 2 = 353 + 1;
- 353 ÷ 2 = 176 + 1;
- 176 ÷ 2 = 88 + 0;
- 88 ÷ 2 = 44 + 0;
- 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.
742 086 384(10) = 10 1100 0011 1011 0101 0110 1111 0000(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:
742 086 384(10) Base 10 integer number converted and written as a signed binary code (in base 2):
742 086 384(10) = 0010 1100 0011 1011 0101 0110 1111 0000
Spaces were used to group digits: for binary, by 4, for decimal, by 3.