What are the required steps to convert base 10 integer
number 43 234 557 295 119 679 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;
- 43 234 557 295 119 679 ÷ 2 = 21 617 278 647 559 839 + 1;
- 21 617 278 647 559 839 ÷ 2 = 10 808 639 323 779 919 + 1;
- 10 808 639 323 779 919 ÷ 2 = 5 404 319 661 889 959 + 1;
- 5 404 319 661 889 959 ÷ 2 = 2 702 159 830 944 979 + 1;
- 2 702 159 830 944 979 ÷ 2 = 1 351 079 915 472 489 + 1;
- 1 351 079 915 472 489 ÷ 2 = 675 539 957 736 244 + 1;
- 675 539 957 736 244 ÷ 2 = 337 769 978 868 122 + 0;
- 337 769 978 868 122 ÷ 2 = 168 884 989 434 061 + 0;
- 168 884 989 434 061 ÷ 2 = 84 442 494 717 030 + 1;
- 84 442 494 717 030 ÷ 2 = 42 221 247 358 515 + 0;
- 42 221 247 358 515 ÷ 2 = 21 110 623 679 257 + 1;
- 21 110 623 679 257 ÷ 2 = 10 555 311 839 628 + 1;
- 10 555 311 839 628 ÷ 2 = 5 277 655 919 814 + 0;
- 5 277 655 919 814 ÷ 2 = 2 638 827 959 907 + 0;
- 2 638 827 959 907 ÷ 2 = 1 319 413 979 953 + 1;
- 1 319 413 979 953 ÷ 2 = 659 706 989 976 + 1;
- 659 706 989 976 ÷ 2 = 329 853 494 988 + 0;
- 329 853 494 988 ÷ 2 = 164 926 747 494 + 0;
- 164 926 747 494 ÷ 2 = 82 463 373 747 + 0;
- 82 463 373 747 ÷ 2 = 41 231 686 873 + 1;
- 41 231 686 873 ÷ 2 = 20 615 843 436 + 1;
- 20 615 843 436 ÷ 2 = 10 307 921 718 + 0;
- 10 307 921 718 ÷ 2 = 5 153 960 859 + 0;
- 5 153 960 859 ÷ 2 = 2 576 980 429 + 1;
- 2 576 980 429 ÷ 2 = 1 288 490 214 + 1;
- 1 288 490 214 ÷ 2 = 644 245 107 + 0;
- 644 245 107 ÷ 2 = 322 122 553 + 1;
- 322 122 553 ÷ 2 = 161 061 276 + 1;
- 161 061 276 ÷ 2 = 80 530 638 + 0;
- 80 530 638 ÷ 2 = 40 265 319 + 0;
- 40 265 319 ÷ 2 = 20 132 659 + 1;
- 20 132 659 ÷ 2 = 10 066 329 + 1;
- 10 066 329 ÷ 2 = 5 033 164 + 1;
- 5 033 164 ÷ 2 = 2 516 582 + 0;
- 2 516 582 ÷ 2 = 1 258 291 + 0;
- 1 258 291 ÷ 2 = 629 145 + 1;
- 629 145 ÷ 2 = 314 572 + 1;
- 314 572 ÷ 2 = 157 286 + 0;
- 157 286 ÷ 2 = 78 643 + 0;
- 78 643 ÷ 2 = 39 321 + 1;
- 39 321 ÷ 2 = 19 660 + 1;
- 19 660 ÷ 2 = 9 830 + 0;
- 9 830 ÷ 2 = 4 915 + 0;
- 4 915 ÷ 2 = 2 457 + 1;
- 2 457 ÷ 2 = 1 228 + 1;
- 1 228 ÷ 2 = 614 + 0;
- 614 ÷ 2 = 307 + 0;
- 307 ÷ 2 = 153 + 1;
- 153 ÷ 2 = 76 + 1;
- 76 ÷ 2 = 38 + 0;
- 38 ÷ 2 = 19 + 0;
- 19 ÷ 2 = 9 + 1;
- 9 ÷ 2 = 4 + 1;
- 4 ÷ 2 = 2 + 0;
- 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.
43 234 557 295 119 679(10) = 1001 1001 1001 1001 1001 1001 1100 1101 1001 1000 1100 1101 0011 1111(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 56.
- 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, 56,
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:
43 234 557 295 119 679(10) Base 10 integer number converted and written as a signed binary code (in base 2):
43 234 557 295 119 679(10) = 0000 0000 1001 1001 1001 1001 1001 1001 1100 1101 1001 1000 1100 1101 0011 1111
Spaces were used to group digits: for binary, by 4, for decimal, by 3.