What are the required steps to convert base 10 integer
number -7 763 756 217 561 121 840 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. Start with the positive version of the number:
|-7 763 756 217 561 121 840| = 7 763 756 217 561 121 840
2. 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;
- 7 763 756 217 561 121 840 ÷ 2 = 3 881 878 108 780 560 920 + 0;
- 3 881 878 108 780 560 920 ÷ 2 = 1 940 939 054 390 280 460 + 0;
- 1 940 939 054 390 280 460 ÷ 2 = 970 469 527 195 140 230 + 0;
- 970 469 527 195 140 230 ÷ 2 = 485 234 763 597 570 115 + 0;
- 485 234 763 597 570 115 ÷ 2 = 242 617 381 798 785 057 + 1;
- 242 617 381 798 785 057 ÷ 2 = 121 308 690 899 392 528 + 1;
- 121 308 690 899 392 528 ÷ 2 = 60 654 345 449 696 264 + 0;
- 60 654 345 449 696 264 ÷ 2 = 30 327 172 724 848 132 + 0;
- 30 327 172 724 848 132 ÷ 2 = 15 163 586 362 424 066 + 0;
- 15 163 586 362 424 066 ÷ 2 = 7 581 793 181 212 033 + 0;
- 7 581 793 181 212 033 ÷ 2 = 3 790 896 590 606 016 + 1;
- 3 790 896 590 606 016 ÷ 2 = 1 895 448 295 303 008 + 0;
- 1 895 448 295 303 008 ÷ 2 = 947 724 147 651 504 + 0;
- 947 724 147 651 504 ÷ 2 = 473 862 073 825 752 + 0;
- 473 862 073 825 752 ÷ 2 = 236 931 036 912 876 + 0;
- 236 931 036 912 876 ÷ 2 = 118 465 518 456 438 + 0;
- 118 465 518 456 438 ÷ 2 = 59 232 759 228 219 + 0;
- 59 232 759 228 219 ÷ 2 = 29 616 379 614 109 + 1;
- 29 616 379 614 109 ÷ 2 = 14 808 189 807 054 + 1;
- 14 808 189 807 054 ÷ 2 = 7 404 094 903 527 + 0;
- 7 404 094 903 527 ÷ 2 = 3 702 047 451 763 + 1;
- 3 702 047 451 763 ÷ 2 = 1 851 023 725 881 + 1;
- 1 851 023 725 881 ÷ 2 = 925 511 862 940 + 1;
- 925 511 862 940 ÷ 2 = 462 755 931 470 + 0;
- 462 755 931 470 ÷ 2 = 231 377 965 735 + 0;
- 231 377 965 735 ÷ 2 = 115 688 982 867 + 1;
- 115 688 982 867 ÷ 2 = 57 844 491 433 + 1;
- 57 844 491 433 ÷ 2 = 28 922 245 716 + 1;
- 28 922 245 716 ÷ 2 = 14 461 122 858 + 0;
- 14 461 122 858 ÷ 2 = 7 230 561 429 + 0;
- 7 230 561 429 ÷ 2 = 3 615 280 714 + 1;
- 3 615 280 714 ÷ 2 = 1 807 640 357 + 0;
- 1 807 640 357 ÷ 2 = 903 820 178 + 1;
- 903 820 178 ÷ 2 = 451 910 089 + 0;
- 451 910 089 ÷ 2 = 225 955 044 + 1;
- 225 955 044 ÷ 2 = 112 977 522 + 0;
- 112 977 522 ÷ 2 = 56 488 761 + 0;
- 56 488 761 ÷ 2 = 28 244 380 + 1;
- 28 244 380 ÷ 2 = 14 122 190 + 0;
- 14 122 190 ÷ 2 = 7 061 095 + 0;
- 7 061 095 ÷ 2 = 3 530 547 + 1;
- 3 530 547 ÷ 2 = 1 765 273 + 1;
- 1 765 273 ÷ 2 = 882 636 + 1;
- 882 636 ÷ 2 = 441 318 + 0;
- 441 318 ÷ 2 = 220 659 + 0;
- 220 659 ÷ 2 = 110 329 + 1;
- 110 329 ÷ 2 = 55 164 + 1;
- 55 164 ÷ 2 = 27 582 + 0;
- 27 582 ÷ 2 = 13 791 + 0;
- 13 791 ÷ 2 = 6 895 + 1;
- 6 895 ÷ 2 = 3 447 + 1;
- 3 447 ÷ 2 = 1 723 + 1;
- 1 723 ÷ 2 = 861 + 1;
- 861 ÷ 2 = 430 + 1;
- 430 ÷ 2 = 215 + 0;
- 215 ÷ 2 = 107 + 1;
- 107 ÷ 2 = 53 + 1;
- 53 ÷ 2 = 26 + 1;
- 26 ÷ 2 = 13 + 0;
- 13 ÷ 2 = 6 + 1;
- 6 ÷ 2 = 3 + 0;
- 3 ÷ 2 = 1 + 1;
- 1 ÷ 2 = 0 + 1;
3. Construct the base 2 representation of the positive number:
Take all the remainders starting from the bottom of the list constructed above.
7 763 756 217 561 121 840(10) = 110 1011 1011 1110 0110 0111 0010 0101 0100 1110 0111 0110 0000 0100 0011 0000(2)
4. 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.
5. 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:
7 763 756 217 561 121 840(10) = 0110 1011 1011 1110 0110 0111 0010 0101 0100 1110 0111 0110 0000 0100 0011 0000
6. Get the negative integer number representation:
To get the negative integer number representation on 64 bits (8 Bytes),
... change the first bit (the leftmost), from 0 to 1...
-7 763 756 217 561 121 840(10) Base 10 integer number converted and written as a signed binary code (in base 2):
-7 763 756 217 561 121 840(10) = 1110 1011 1011 1110 0110 0111 0010 0101 0100 1110 0111 0110 0000 0100 0011 0000
Spaces were used to group digits: for binary, by 4, for decimal, by 3.