What are the required steps to convert base 10 integer
number -476 770 269 091 693 716 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:
|-476 770 269 091 693 716| = 476 770 269 091 693 716
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;
- 476 770 269 091 693 716 ÷ 2 = 238 385 134 545 846 858 + 0;
- 238 385 134 545 846 858 ÷ 2 = 119 192 567 272 923 429 + 0;
- 119 192 567 272 923 429 ÷ 2 = 59 596 283 636 461 714 + 1;
- 59 596 283 636 461 714 ÷ 2 = 29 798 141 818 230 857 + 0;
- 29 798 141 818 230 857 ÷ 2 = 14 899 070 909 115 428 + 1;
- 14 899 070 909 115 428 ÷ 2 = 7 449 535 454 557 714 + 0;
- 7 449 535 454 557 714 ÷ 2 = 3 724 767 727 278 857 + 0;
- 3 724 767 727 278 857 ÷ 2 = 1 862 383 863 639 428 + 1;
- 1 862 383 863 639 428 ÷ 2 = 931 191 931 819 714 + 0;
- 931 191 931 819 714 ÷ 2 = 465 595 965 909 857 + 0;
- 465 595 965 909 857 ÷ 2 = 232 797 982 954 928 + 1;
- 232 797 982 954 928 ÷ 2 = 116 398 991 477 464 + 0;
- 116 398 991 477 464 ÷ 2 = 58 199 495 738 732 + 0;
- 58 199 495 738 732 ÷ 2 = 29 099 747 869 366 + 0;
- 29 099 747 869 366 ÷ 2 = 14 549 873 934 683 + 0;
- 14 549 873 934 683 ÷ 2 = 7 274 936 967 341 + 1;
- 7 274 936 967 341 ÷ 2 = 3 637 468 483 670 + 1;
- 3 637 468 483 670 ÷ 2 = 1 818 734 241 835 + 0;
- 1 818 734 241 835 ÷ 2 = 909 367 120 917 + 1;
- 909 367 120 917 ÷ 2 = 454 683 560 458 + 1;
- 454 683 560 458 ÷ 2 = 227 341 780 229 + 0;
- 227 341 780 229 ÷ 2 = 113 670 890 114 + 1;
- 113 670 890 114 ÷ 2 = 56 835 445 057 + 0;
- 56 835 445 057 ÷ 2 = 28 417 722 528 + 1;
- 28 417 722 528 ÷ 2 = 14 208 861 264 + 0;
- 14 208 861 264 ÷ 2 = 7 104 430 632 + 0;
- 7 104 430 632 ÷ 2 = 3 552 215 316 + 0;
- 3 552 215 316 ÷ 2 = 1 776 107 658 + 0;
- 1 776 107 658 ÷ 2 = 888 053 829 + 0;
- 888 053 829 ÷ 2 = 444 026 914 + 1;
- 444 026 914 ÷ 2 = 222 013 457 + 0;
- 222 013 457 ÷ 2 = 111 006 728 + 1;
- 111 006 728 ÷ 2 = 55 503 364 + 0;
- 55 503 364 ÷ 2 = 27 751 682 + 0;
- 27 751 682 ÷ 2 = 13 875 841 + 0;
- 13 875 841 ÷ 2 = 6 937 920 + 1;
- 6 937 920 ÷ 2 = 3 468 960 + 0;
- 3 468 960 ÷ 2 = 1 734 480 + 0;
- 1 734 480 ÷ 2 = 867 240 + 0;
- 867 240 ÷ 2 = 433 620 + 0;
- 433 620 ÷ 2 = 216 810 + 0;
- 216 810 ÷ 2 = 108 405 + 0;
- 108 405 ÷ 2 = 54 202 + 1;
- 54 202 ÷ 2 = 27 101 + 0;
- 27 101 ÷ 2 = 13 550 + 1;
- 13 550 ÷ 2 = 6 775 + 0;
- 6 775 ÷ 2 = 3 387 + 1;
- 3 387 ÷ 2 = 1 693 + 1;
- 1 693 ÷ 2 = 846 + 1;
- 846 ÷ 2 = 423 + 0;
- 423 ÷ 2 = 211 + 1;
- 211 ÷ 2 = 105 + 1;
- 105 ÷ 2 = 52 + 1;
- 52 ÷ 2 = 26 + 0;
- 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.
476 770 269 091 693 716(10) = 110 1001 1101 1101 0100 0000 1000 1010 0000 1010 1101 1000 0100 1001 0100(2)
4. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 59.
- 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, 59,
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:
476 770 269 091 693 716(10) = 0000 0110 1001 1101 1101 0100 0000 1000 1010 0000 1010 1101 1000 0100 1001 0100
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...
-476 770 269 091 693 716(10) Base 10 integer number converted and written as a signed binary code (in base 2):
-476 770 269 091 693 716(10) = 1000 0110 1001 1101 1101 0100 0000 1000 1010 0000 1010 1101 1000 0100 1001 0100
Spaces were used to group digits: for binary, by 4, for decimal, by 3.