What are the required steps to convert base 10 integer
number 8 793 278 316 383 116 498 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;
- 8 793 278 316 383 116 498 ÷ 2 = 4 396 639 158 191 558 249 + 0;
- 4 396 639 158 191 558 249 ÷ 2 = 2 198 319 579 095 779 124 + 1;
- 2 198 319 579 095 779 124 ÷ 2 = 1 099 159 789 547 889 562 + 0;
- 1 099 159 789 547 889 562 ÷ 2 = 549 579 894 773 944 781 + 0;
- 549 579 894 773 944 781 ÷ 2 = 274 789 947 386 972 390 + 1;
- 274 789 947 386 972 390 ÷ 2 = 137 394 973 693 486 195 + 0;
- 137 394 973 693 486 195 ÷ 2 = 68 697 486 846 743 097 + 1;
- 68 697 486 846 743 097 ÷ 2 = 34 348 743 423 371 548 + 1;
- 34 348 743 423 371 548 ÷ 2 = 17 174 371 711 685 774 + 0;
- 17 174 371 711 685 774 ÷ 2 = 8 587 185 855 842 887 + 0;
- 8 587 185 855 842 887 ÷ 2 = 4 293 592 927 921 443 + 1;
- 4 293 592 927 921 443 ÷ 2 = 2 146 796 463 960 721 + 1;
- 2 146 796 463 960 721 ÷ 2 = 1 073 398 231 980 360 + 1;
- 1 073 398 231 980 360 ÷ 2 = 536 699 115 990 180 + 0;
- 536 699 115 990 180 ÷ 2 = 268 349 557 995 090 + 0;
- 268 349 557 995 090 ÷ 2 = 134 174 778 997 545 + 0;
- 134 174 778 997 545 ÷ 2 = 67 087 389 498 772 + 1;
- 67 087 389 498 772 ÷ 2 = 33 543 694 749 386 + 0;
- 33 543 694 749 386 ÷ 2 = 16 771 847 374 693 + 0;
- 16 771 847 374 693 ÷ 2 = 8 385 923 687 346 + 1;
- 8 385 923 687 346 ÷ 2 = 4 192 961 843 673 + 0;
- 4 192 961 843 673 ÷ 2 = 2 096 480 921 836 + 1;
- 2 096 480 921 836 ÷ 2 = 1 048 240 460 918 + 0;
- 1 048 240 460 918 ÷ 2 = 524 120 230 459 + 0;
- 524 120 230 459 ÷ 2 = 262 060 115 229 + 1;
- 262 060 115 229 ÷ 2 = 131 030 057 614 + 1;
- 131 030 057 614 ÷ 2 = 65 515 028 807 + 0;
- 65 515 028 807 ÷ 2 = 32 757 514 403 + 1;
- 32 757 514 403 ÷ 2 = 16 378 757 201 + 1;
- 16 378 757 201 ÷ 2 = 8 189 378 600 + 1;
- 8 189 378 600 ÷ 2 = 4 094 689 300 + 0;
- 4 094 689 300 ÷ 2 = 2 047 344 650 + 0;
- 2 047 344 650 ÷ 2 = 1 023 672 325 + 0;
- 1 023 672 325 ÷ 2 = 511 836 162 + 1;
- 511 836 162 ÷ 2 = 255 918 081 + 0;
- 255 918 081 ÷ 2 = 127 959 040 + 1;
- 127 959 040 ÷ 2 = 63 979 520 + 0;
- 63 979 520 ÷ 2 = 31 989 760 + 0;
- 31 989 760 ÷ 2 = 15 994 880 + 0;
- 15 994 880 ÷ 2 = 7 997 440 + 0;
- 7 997 440 ÷ 2 = 3 998 720 + 0;
- 3 998 720 ÷ 2 = 1 999 360 + 0;
- 1 999 360 ÷ 2 = 999 680 + 0;
- 999 680 ÷ 2 = 499 840 + 0;
- 499 840 ÷ 2 = 249 920 + 0;
- 249 920 ÷ 2 = 124 960 + 0;
- 124 960 ÷ 2 = 62 480 + 0;
- 62 480 ÷ 2 = 31 240 + 0;
- 31 240 ÷ 2 = 15 620 + 0;
- 15 620 ÷ 2 = 7 810 + 0;
- 7 810 ÷ 2 = 3 905 + 0;
- 3 905 ÷ 2 = 1 952 + 1;
- 1 952 ÷ 2 = 976 + 0;
- 976 ÷ 2 = 488 + 0;
- 488 ÷ 2 = 244 + 0;
- 244 ÷ 2 = 122 + 0;
- 122 ÷ 2 = 61 + 0;
- 61 ÷ 2 = 30 + 1;
- 30 ÷ 2 = 15 + 0;
- 15 ÷ 2 = 7 + 1;
- 7 ÷ 2 = 3 + 1;
- 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.
8 793 278 316 383 116 498(10) = 111 1010 0000 1000 0000 0000 0000 1010 0011 1011 0010 1001 0001 1100 1101 0010(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 63.
- 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, 63,
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:
8 793 278 316 383 116 498(10) Base 10 integer number converted and written as a signed binary code (in base 2):
8 793 278 316 383 116 498(10) = 0111 1010 0000 1000 0000 0000 0000 1010 0011 1011 0010 1001 0001 1100 1101 0010
Spaces were used to group digits: for binary, by 4, for decimal, by 3.