What are the required steps to convert base 10 integer
number 922 222 222 222 222 154 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;
- 922 222 222 222 222 154 ÷ 2 = 461 111 111 111 111 077 + 0;
- 461 111 111 111 111 077 ÷ 2 = 230 555 555 555 555 538 + 1;
- 230 555 555 555 555 538 ÷ 2 = 115 277 777 777 777 769 + 0;
- 115 277 777 777 777 769 ÷ 2 = 57 638 888 888 888 884 + 1;
- 57 638 888 888 888 884 ÷ 2 = 28 819 444 444 444 442 + 0;
- 28 819 444 444 444 442 ÷ 2 = 14 409 722 222 222 221 + 0;
- 14 409 722 222 222 221 ÷ 2 = 7 204 861 111 111 110 + 1;
- 7 204 861 111 111 110 ÷ 2 = 3 602 430 555 555 555 + 0;
- 3 602 430 555 555 555 ÷ 2 = 1 801 215 277 777 777 + 1;
- 1 801 215 277 777 777 ÷ 2 = 900 607 638 888 888 + 1;
- 900 607 638 888 888 ÷ 2 = 450 303 819 444 444 + 0;
- 450 303 819 444 444 ÷ 2 = 225 151 909 722 222 + 0;
- 225 151 909 722 222 ÷ 2 = 112 575 954 861 111 + 0;
- 112 575 954 861 111 ÷ 2 = 56 287 977 430 555 + 1;
- 56 287 977 430 555 ÷ 2 = 28 143 988 715 277 + 1;
- 28 143 988 715 277 ÷ 2 = 14 071 994 357 638 + 1;
- 14 071 994 357 638 ÷ 2 = 7 035 997 178 819 + 0;
- 7 035 997 178 819 ÷ 2 = 3 517 998 589 409 + 1;
- 3 517 998 589 409 ÷ 2 = 1 758 999 294 704 + 1;
- 1 758 999 294 704 ÷ 2 = 879 499 647 352 + 0;
- 879 499 647 352 ÷ 2 = 439 749 823 676 + 0;
- 439 749 823 676 ÷ 2 = 219 874 911 838 + 0;
- 219 874 911 838 ÷ 2 = 109 937 455 919 + 0;
- 109 937 455 919 ÷ 2 = 54 968 727 959 + 1;
- 54 968 727 959 ÷ 2 = 27 484 363 979 + 1;
- 27 484 363 979 ÷ 2 = 13 742 181 989 + 1;
- 13 742 181 989 ÷ 2 = 6 871 090 994 + 1;
- 6 871 090 994 ÷ 2 = 3 435 545 497 + 0;
- 3 435 545 497 ÷ 2 = 1 717 772 748 + 1;
- 1 717 772 748 ÷ 2 = 858 886 374 + 0;
- 858 886 374 ÷ 2 = 429 443 187 + 0;
- 429 443 187 ÷ 2 = 214 721 593 + 1;
- 214 721 593 ÷ 2 = 107 360 796 + 1;
- 107 360 796 ÷ 2 = 53 680 398 + 0;
- 53 680 398 ÷ 2 = 26 840 199 + 0;
- 26 840 199 ÷ 2 = 13 420 099 + 1;
- 13 420 099 ÷ 2 = 6 710 049 + 1;
- 6 710 049 ÷ 2 = 3 355 024 + 1;
- 3 355 024 ÷ 2 = 1 677 512 + 0;
- 1 677 512 ÷ 2 = 838 756 + 0;
- 838 756 ÷ 2 = 419 378 + 0;
- 419 378 ÷ 2 = 209 689 + 0;
- 209 689 ÷ 2 = 104 844 + 1;
- 104 844 ÷ 2 = 52 422 + 0;
- 52 422 ÷ 2 = 26 211 + 0;
- 26 211 ÷ 2 = 13 105 + 1;
- 13 105 ÷ 2 = 6 552 + 1;
- 6 552 ÷ 2 = 3 276 + 0;
- 3 276 ÷ 2 = 1 638 + 0;
- 1 638 ÷ 2 = 819 + 0;
- 819 ÷ 2 = 409 + 1;
- 409 ÷ 2 = 204 + 1;
- 204 ÷ 2 = 102 + 0;
- 102 ÷ 2 = 51 + 0;
- 51 ÷ 2 = 25 + 1;
- 25 ÷ 2 = 12 + 1;
- 12 ÷ 2 = 6 + 0;
- 6 ÷ 2 = 3 + 0;
- 3 ÷ 2 = 1 + 1;
- 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.
922 222 222 222 222 154(10) = 1100 1100 1100 0110 0100 0011 1001 1001 0111 1000 0110 1110 0011 0100 1010(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 60.
- 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, 60,
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:
922 222 222 222 222 154(10) Base 10 integer number converted and written as a signed binary code (in base 2):
922 222 222 222 222 154(10) = 0000 1100 1100 1100 0110 0100 0011 1001 1001 0111 1000 0110 1110 0011 0100 1010
Spaces were used to group digits: for binary, by 4, for decimal, by 3.