What are the required steps to convert base 10 integer
number -6 183 647 350 288 908 082 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:
|-6 183 647 350 288 908 082| = 6 183 647 350 288 908 082
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;
- 6 183 647 350 288 908 082 ÷ 2 = 3 091 823 675 144 454 041 + 0;
- 3 091 823 675 144 454 041 ÷ 2 = 1 545 911 837 572 227 020 + 1;
- 1 545 911 837 572 227 020 ÷ 2 = 772 955 918 786 113 510 + 0;
- 772 955 918 786 113 510 ÷ 2 = 386 477 959 393 056 755 + 0;
- 386 477 959 393 056 755 ÷ 2 = 193 238 979 696 528 377 + 1;
- 193 238 979 696 528 377 ÷ 2 = 96 619 489 848 264 188 + 1;
- 96 619 489 848 264 188 ÷ 2 = 48 309 744 924 132 094 + 0;
- 48 309 744 924 132 094 ÷ 2 = 24 154 872 462 066 047 + 0;
- 24 154 872 462 066 047 ÷ 2 = 12 077 436 231 033 023 + 1;
- 12 077 436 231 033 023 ÷ 2 = 6 038 718 115 516 511 + 1;
- 6 038 718 115 516 511 ÷ 2 = 3 019 359 057 758 255 + 1;
- 3 019 359 057 758 255 ÷ 2 = 1 509 679 528 879 127 + 1;
- 1 509 679 528 879 127 ÷ 2 = 754 839 764 439 563 + 1;
- 754 839 764 439 563 ÷ 2 = 377 419 882 219 781 + 1;
- 377 419 882 219 781 ÷ 2 = 188 709 941 109 890 + 1;
- 188 709 941 109 890 ÷ 2 = 94 354 970 554 945 + 0;
- 94 354 970 554 945 ÷ 2 = 47 177 485 277 472 + 1;
- 47 177 485 277 472 ÷ 2 = 23 588 742 638 736 + 0;
- 23 588 742 638 736 ÷ 2 = 11 794 371 319 368 + 0;
- 11 794 371 319 368 ÷ 2 = 5 897 185 659 684 + 0;
- 5 897 185 659 684 ÷ 2 = 2 948 592 829 842 + 0;
- 2 948 592 829 842 ÷ 2 = 1 474 296 414 921 + 0;
- 1 474 296 414 921 ÷ 2 = 737 148 207 460 + 1;
- 737 148 207 460 ÷ 2 = 368 574 103 730 + 0;
- 368 574 103 730 ÷ 2 = 184 287 051 865 + 0;
- 184 287 051 865 ÷ 2 = 92 143 525 932 + 1;
- 92 143 525 932 ÷ 2 = 46 071 762 966 + 0;
- 46 071 762 966 ÷ 2 = 23 035 881 483 + 0;
- 23 035 881 483 ÷ 2 = 11 517 940 741 + 1;
- 11 517 940 741 ÷ 2 = 5 758 970 370 + 1;
- 5 758 970 370 ÷ 2 = 2 879 485 185 + 0;
- 2 879 485 185 ÷ 2 = 1 439 742 592 + 1;
- 1 439 742 592 ÷ 2 = 719 871 296 + 0;
- 719 871 296 ÷ 2 = 359 935 648 + 0;
- 359 935 648 ÷ 2 = 179 967 824 + 0;
- 179 967 824 ÷ 2 = 89 983 912 + 0;
- 89 983 912 ÷ 2 = 44 991 956 + 0;
- 44 991 956 ÷ 2 = 22 495 978 + 0;
- 22 495 978 ÷ 2 = 11 247 989 + 0;
- 11 247 989 ÷ 2 = 5 623 994 + 1;
- 5 623 994 ÷ 2 = 2 811 997 + 0;
- 2 811 997 ÷ 2 = 1 405 998 + 1;
- 1 405 998 ÷ 2 = 702 999 + 0;
- 702 999 ÷ 2 = 351 499 + 1;
- 351 499 ÷ 2 = 175 749 + 1;
- 175 749 ÷ 2 = 87 874 + 1;
- 87 874 ÷ 2 = 43 937 + 0;
- 43 937 ÷ 2 = 21 968 + 1;
- 21 968 ÷ 2 = 10 984 + 0;
- 10 984 ÷ 2 = 5 492 + 0;
- 5 492 ÷ 2 = 2 746 + 0;
- 2 746 ÷ 2 = 1 373 + 0;
- 1 373 ÷ 2 = 686 + 1;
- 686 ÷ 2 = 343 + 0;
- 343 ÷ 2 = 171 + 1;
- 171 ÷ 2 = 85 + 1;
- 85 ÷ 2 = 42 + 1;
- 42 ÷ 2 = 21 + 0;
- 21 ÷ 2 = 10 + 1;
- 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.
6 183 647 350 288 908 082(10) = 101 0101 1101 0000 1011 1010 1000 0000 1011 0010 0100 0001 0111 1111 0011 0010(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:
6 183 647 350 288 908 082(10) = 0101 0101 1101 0000 1011 1010 1000 0000 1011 0010 0100 0001 0111 1111 0011 0010
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...
-6 183 647 350 288 908 082(10) Base 10 integer number converted and written as a signed binary code (in base 2):
-6 183 647 350 288 908 082(10) = 1101 0101 1101 0000 1011 1010 1000 0000 1011 0010 0100 0001 0111 1111 0011 0010
Spaces were used to group digits: for binary, by 4, for decimal, by 3.