What are the required steps to convert base 10 integer
number -556 121 437 483 305 099 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:
|-556 121 437 483 305 099| = 556 121 437 483 305 099
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;
- 556 121 437 483 305 099 ÷ 2 = 278 060 718 741 652 549 + 1;
- 278 060 718 741 652 549 ÷ 2 = 139 030 359 370 826 274 + 1;
- 139 030 359 370 826 274 ÷ 2 = 69 515 179 685 413 137 + 0;
- 69 515 179 685 413 137 ÷ 2 = 34 757 589 842 706 568 + 1;
- 34 757 589 842 706 568 ÷ 2 = 17 378 794 921 353 284 + 0;
- 17 378 794 921 353 284 ÷ 2 = 8 689 397 460 676 642 + 0;
- 8 689 397 460 676 642 ÷ 2 = 4 344 698 730 338 321 + 0;
- 4 344 698 730 338 321 ÷ 2 = 2 172 349 365 169 160 + 1;
- 2 172 349 365 169 160 ÷ 2 = 1 086 174 682 584 580 + 0;
- 1 086 174 682 584 580 ÷ 2 = 543 087 341 292 290 + 0;
- 543 087 341 292 290 ÷ 2 = 271 543 670 646 145 + 0;
- 271 543 670 646 145 ÷ 2 = 135 771 835 323 072 + 1;
- 135 771 835 323 072 ÷ 2 = 67 885 917 661 536 + 0;
- 67 885 917 661 536 ÷ 2 = 33 942 958 830 768 + 0;
- 33 942 958 830 768 ÷ 2 = 16 971 479 415 384 + 0;
- 16 971 479 415 384 ÷ 2 = 8 485 739 707 692 + 0;
- 8 485 739 707 692 ÷ 2 = 4 242 869 853 846 + 0;
- 4 242 869 853 846 ÷ 2 = 2 121 434 926 923 + 0;
- 2 121 434 926 923 ÷ 2 = 1 060 717 463 461 + 1;
- 1 060 717 463 461 ÷ 2 = 530 358 731 730 + 1;
- 530 358 731 730 ÷ 2 = 265 179 365 865 + 0;
- 265 179 365 865 ÷ 2 = 132 589 682 932 + 1;
- 132 589 682 932 ÷ 2 = 66 294 841 466 + 0;
- 66 294 841 466 ÷ 2 = 33 147 420 733 + 0;
- 33 147 420 733 ÷ 2 = 16 573 710 366 + 1;
- 16 573 710 366 ÷ 2 = 8 286 855 183 + 0;
- 8 286 855 183 ÷ 2 = 4 143 427 591 + 1;
- 4 143 427 591 ÷ 2 = 2 071 713 795 + 1;
- 2 071 713 795 ÷ 2 = 1 035 856 897 + 1;
- 1 035 856 897 ÷ 2 = 517 928 448 + 1;
- 517 928 448 ÷ 2 = 258 964 224 + 0;
- 258 964 224 ÷ 2 = 129 482 112 + 0;
- 129 482 112 ÷ 2 = 64 741 056 + 0;
- 64 741 056 ÷ 2 = 32 370 528 + 0;
- 32 370 528 ÷ 2 = 16 185 264 + 0;
- 16 185 264 ÷ 2 = 8 092 632 + 0;
- 8 092 632 ÷ 2 = 4 046 316 + 0;
- 4 046 316 ÷ 2 = 2 023 158 + 0;
- 2 023 158 ÷ 2 = 1 011 579 + 0;
- 1 011 579 ÷ 2 = 505 789 + 1;
- 505 789 ÷ 2 = 252 894 + 1;
- 252 894 ÷ 2 = 126 447 + 0;
- 126 447 ÷ 2 = 63 223 + 1;
- 63 223 ÷ 2 = 31 611 + 1;
- 31 611 ÷ 2 = 15 805 + 1;
- 15 805 ÷ 2 = 7 902 + 1;
- 7 902 ÷ 2 = 3 951 + 0;
- 3 951 ÷ 2 = 1 975 + 1;
- 1 975 ÷ 2 = 987 + 1;
- 987 ÷ 2 = 493 + 1;
- 493 ÷ 2 = 246 + 1;
- 246 ÷ 2 = 123 + 0;
- 123 ÷ 2 = 61 + 1;
- 61 ÷ 2 = 30 + 1;
- 30 ÷ 2 = 15 + 0;
- 15 ÷ 2 = 7 + 1;
- 7 ÷ 2 = 3 + 1;
- 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.
556 121 437 483 305 099(10) = 111 1011 0111 1011 1101 1000 0000 0011 1101 0010 1100 0000 1000 1000 1011(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:
556 121 437 483 305 099(10) = 0000 0111 1011 0111 1011 1101 1000 0000 0011 1101 0010 1100 0000 1000 1000 1011
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...
-556 121 437 483 305 099(10) Base 10 integer number converted and written as a signed binary code (in base 2):
-556 121 437 483 305 099(10) = 1000 0111 1011 0111 1011 1101 1000 0000 0011 1101 0010 1100 0000 1000 1000 1011
Spaces were used to group digits: for binary, by 4, for decimal, by 3.