What are the required steps to convert base 10 integer
number 24 800 110 234 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;
- 24 800 110 234 ÷ 2 = 12 400 055 117 + 0;
- 12 400 055 117 ÷ 2 = 6 200 027 558 + 1;
- 6 200 027 558 ÷ 2 = 3 100 013 779 + 0;
- 3 100 013 779 ÷ 2 = 1 550 006 889 + 1;
- 1 550 006 889 ÷ 2 = 775 003 444 + 1;
- 775 003 444 ÷ 2 = 387 501 722 + 0;
- 387 501 722 ÷ 2 = 193 750 861 + 0;
- 193 750 861 ÷ 2 = 96 875 430 + 1;
- 96 875 430 ÷ 2 = 48 437 715 + 0;
- 48 437 715 ÷ 2 = 24 218 857 + 1;
- 24 218 857 ÷ 2 = 12 109 428 + 1;
- 12 109 428 ÷ 2 = 6 054 714 + 0;
- 6 054 714 ÷ 2 = 3 027 357 + 0;
- 3 027 357 ÷ 2 = 1 513 678 + 1;
- 1 513 678 ÷ 2 = 756 839 + 0;
- 756 839 ÷ 2 = 378 419 + 1;
- 378 419 ÷ 2 = 189 209 + 1;
- 189 209 ÷ 2 = 94 604 + 1;
- 94 604 ÷ 2 = 47 302 + 0;
- 47 302 ÷ 2 = 23 651 + 0;
- 23 651 ÷ 2 = 11 825 + 1;
- 11 825 ÷ 2 = 5 912 + 1;
- 5 912 ÷ 2 = 2 956 + 0;
- 2 956 ÷ 2 = 1 478 + 0;
- 1 478 ÷ 2 = 739 + 0;
- 739 ÷ 2 = 369 + 1;
- 369 ÷ 2 = 184 + 1;
- 184 ÷ 2 = 92 + 0;
- 92 ÷ 2 = 46 + 0;
- 46 ÷ 2 = 23 + 0;
- 23 ÷ 2 = 11 + 1;
- 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.
24 800 110 234(10) = 101 1100 0110 0011 0011 1010 0110 1001 1010(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 35.
- 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, 35,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 64.
4. Get the positive binary computer representation on 64 bits (8 Bytes):
If needed, add extra 0s in front (to the left) of the base 2 number, up to the required length, 64:
24 800 110 234(10) Base 10 integer number converted and written as a signed binary code (in base 2):
24 800 110 234(10) = 0000 0000 0000 0000 0000 0000 0000 0101 1100 0110 0011 0011 1010 0110 1001 1010
Spaces were used to group digits: for binary, by 4, for decimal, by 3.