What are the required steps to convert base 10 integer
number -733 307 779 761 752 639 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:
|-733 307 779 761 752 639| = 733 307 779 761 752 639
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;
- 733 307 779 761 752 639 ÷ 2 = 366 653 889 880 876 319 + 1;
- 366 653 889 880 876 319 ÷ 2 = 183 326 944 940 438 159 + 1;
- 183 326 944 940 438 159 ÷ 2 = 91 663 472 470 219 079 + 1;
- 91 663 472 470 219 079 ÷ 2 = 45 831 736 235 109 539 + 1;
- 45 831 736 235 109 539 ÷ 2 = 22 915 868 117 554 769 + 1;
- 22 915 868 117 554 769 ÷ 2 = 11 457 934 058 777 384 + 1;
- 11 457 934 058 777 384 ÷ 2 = 5 728 967 029 388 692 + 0;
- 5 728 967 029 388 692 ÷ 2 = 2 864 483 514 694 346 + 0;
- 2 864 483 514 694 346 ÷ 2 = 1 432 241 757 347 173 + 0;
- 1 432 241 757 347 173 ÷ 2 = 716 120 878 673 586 + 1;
- 716 120 878 673 586 ÷ 2 = 358 060 439 336 793 + 0;
- 358 060 439 336 793 ÷ 2 = 179 030 219 668 396 + 1;
- 179 030 219 668 396 ÷ 2 = 89 515 109 834 198 + 0;
- 89 515 109 834 198 ÷ 2 = 44 757 554 917 099 + 0;
- 44 757 554 917 099 ÷ 2 = 22 378 777 458 549 + 1;
- 22 378 777 458 549 ÷ 2 = 11 189 388 729 274 + 1;
- 11 189 388 729 274 ÷ 2 = 5 594 694 364 637 + 0;
- 5 594 694 364 637 ÷ 2 = 2 797 347 182 318 + 1;
- 2 797 347 182 318 ÷ 2 = 1 398 673 591 159 + 0;
- 1 398 673 591 159 ÷ 2 = 699 336 795 579 + 1;
- 699 336 795 579 ÷ 2 = 349 668 397 789 + 1;
- 349 668 397 789 ÷ 2 = 174 834 198 894 + 1;
- 174 834 198 894 ÷ 2 = 87 417 099 447 + 0;
- 87 417 099 447 ÷ 2 = 43 708 549 723 + 1;
- 43 708 549 723 ÷ 2 = 21 854 274 861 + 1;
- 21 854 274 861 ÷ 2 = 10 927 137 430 + 1;
- 10 927 137 430 ÷ 2 = 5 463 568 715 + 0;
- 5 463 568 715 ÷ 2 = 2 731 784 357 + 1;
- 2 731 784 357 ÷ 2 = 1 365 892 178 + 1;
- 1 365 892 178 ÷ 2 = 682 946 089 + 0;
- 682 946 089 ÷ 2 = 341 473 044 + 1;
- 341 473 044 ÷ 2 = 170 736 522 + 0;
- 170 736 522 ÷ 2 = 85 368 261 + 0;
- 85 368 261 ÷ 2 = 42 684 130 + 1;
- 42 684 130 ÷ 2 = 21 342 065 + 0;
- 21 342 065 ÷ 2 = 10 671 032 + 1;
- 10 671 032 ÷ 2 = 5 335 516 + 0;
- 5 335 516 ÷ 2 = 2 667 758 + 0;
- 2 667 758 ÷ 2 = 1 333 879 + 0;
- 1 333 879 ÷ 2 = 666 939 + 1;
- 666 939 ÷ 2 = 333 469 + 1;
- 333 469 ÷ 2 = 166 734 + 1;
- 166 734 ÷ 2 = 83 367 + 0;
- 83 367 ÷ 2 = 41 683 + 1;
- 41 683 ÷ 2 = 20 841 + 1;
- 20 841 ÷ 2 = 10 420 + 1;
- 10 420 ÷ 2 = 5 210 + 0;
- 5 210 ÷ 2 = 2 605 + 0;
- 2 605 ÷ 2 = 1 302 + 1;
- 1 302 ÷ 2 = 651 + 0;
- 651 ÷ 2 = 325 + 1;
- 325 ÷ 2 = 162 + 1;
- 162 ÷ 2 = 81 + 0;
- 81 ÷ 2 = 40 + 1;
- 40 ÷ 2 = 20 + 0;
- 20 ÷ 2 = 10 + 0;
- 10 ÷ 2 = 5 + 0;
- 5 ÷ 2 = 2 + 1;
- 2 ÷ 2 = 1 + 0;
- 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.
733 307 779 761 752 639(10) = 1010 0010 1101 0011 1011 1000 1010 0101 1011 1011 1010 1100 1010 0011 1111(2)
4. 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.
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:
733 307 779 761 752 639(10) = 0000 1010 0010 1101 0011 1011 1000 1010 0101 1011 1011 1010 1100 1010 0011 1111
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...
-733 307 779 761 752 639(10) Base 10 integer number converted and written as a signed binary code (in base 2):
-733 307 779 761 752 639(10) = 1000 1010 0010 1101 0011 1011 1000 1010 0101 1011 1011 1010 1100 1010 0011 1111
Spaces were used to group digits: for binary, by 4, for decimal, by 3.