Convert -3 513 572 480 492 223 984 to a Signed Binary in Two's (2's) Complement Representation
How to convert decimal number -3 513 572 480 492 223 984(10) to a signed binary in two's (2's) complement representation
What are the steps to convert decimal number
-3 513 572 480 492 223 984 to a signed binary in two's (2's) complement representation?
- 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:
|-3 513 572 480 492 223 984| = 3 513 572 480 492 223 984
2. Divide the number repeatedly by 2:
Keep track of each remainder.
We stop when we get a quotient that is equal to zero.
- division = quotient + remainder;
- 3 513 572 480 492 223 984 ÷ 2 = 1 756 786 240 246 111 992 + 0;
- 1 756 786 240 246 111 992 ÷ 2 = 878 393 120 123 055 996 + 0;
- 878 393 120 123 055 996 ÷ 2 = 439 196 560 061 527 998 + 0;
- 439 196 560 061 527 998 ÷ 2 = 219 598 280 030 763 999 + 0;
- 219 598 280 030 763 999 ÷ 2 = 109 799 140 015 381 999 + 1;
- 109 799 140 015 381 999 ÷ 2 = 54 899 570 007 690 999 + 1;
- 54 899 570 007 690 999 ÷ 2 = 27 449 785 003 845 499 + 1;
- 27 449 785 003 845 499 ÷ 2 = 13 724 892 501 922 749 + 1;
- 13 724 892 501 922 749 ÷ 2 = 6 862 446 250 961 374 + 1;
- 6 862 446 250 961 374 ÷ 2 = 3 431 223 125 480 687 + 0;
- 3 431 223 125 480 687 ÷ 2 = 1 715 611 562 740 343 + 1;
- 1 715 611 562 740 343 ÷ 2 = 857 805 781 370 171 + 1;
- 857 805 781 370 171 ÷ 2 = 428 902 890 685 085 + 1;
- 428 902 890 685 085 ÷ 2 = 214 451 445 342 542 + 1;
- 214 451 445 342 542 ÷ 2 = 107 225 722 671 271 + 0;
- 107 225 722 671 271 ÷ 2 = 53 612 861 335 635 + 1;
- 53 612 861 335 635 ÷ 2 = 26 806 430 667 817 + 1;
- 26 806 430 667 817 ÷ 2 = 13 403 215 333 908 + 1;
- 13 403 215 333 908 ÷ 2 = 6 701 607 666 954 + 0;
- 6 701 607 666 954 ÷ 2 = 3 350 803 833 477 + 0;
- 3 350 803 833 477 ÷ 2 = 1 675 401 916 738 + 1;
- 1 675 401 916 738 ÷ 2 = 837 700 958 369 + 0;
- 837 700 958 369 ÷ 2 = 418 850 479 184 + 1;
- 418 850 479 184 ÷ 2 = 209 425 239 592 + 0;
- 209 425 239 592 ÷ 2 = 104 712 619 796 + 0;
- 104 712 619 796 ÷ 2 = 52 356 309 898 + 0;
- 52 356 309 898 ÷ 2 = 26 178 154 949 + 0;
- 26 178 154 949 ÷ 2 = 13 089 077 474 + 1;
- 13 089 077 474 ÷ 2 = 6 544 538 737 + 0;
- 6 544 538 737 ÷ 2 = 3 272 269 368 + 1;
- 3 272 269 368 ÷ 2 = 1 636 134 684 + 0;
- 1 636 134 684 ÷ 2 = 818 067 342 + 0;
- 818 067 342 ÷ 2 = 409 033 671 + 0;
- 409 033 671 ÷ 2 = 204 516 835 + 1;
- 204 516 835 ÷ 2 = 102 258 417 + 1;
- 102 258 417 ÷ 2 = 51 129 208 + 1;
- 51 129 208 ÷ 2 = 25 564 604 + 0;
- 25 564 604 ÷ 2 = 12 782 302 + 0;
- 12 782 302 ÷ 2 = 6 391 151 + 0;
- 6 391 151 ÷ 2 = 3 195 575 + 1;
- 3 195 575 ÷ 2 = 1 597 787 + 1;
- 1 597 787 ÷ 2 = 798 893 + 1;
- 798 893 ÷ 2 = 399 446 + 1;
- 399 446 ÷ 2 = 199 723 + 0;
- 199 723 ÷ 2 = 99 861 + 1;
- 99 861 ÷ 2 = 49 930 + 1;
- 49 930 ÷ 2 = 24 965 + 0;
- 24 965 ÷ 2 = 12 482 + 1;
- 12 482 ÷ 2 = 6 241 + 0;
- 6 241 ÷ 2 = 3 120 + 1;
- 3 120 ÷ 2 = 1 560 + 0;
- 1 560 ÷ 2 = 780 + 0;
- 780 ÷ 2 = 390 + 0;
- 390 ÷ 2 = 195 + 0;
- 195 ÷ 2 = 97 + 1;
- 97 ÷ 2 = 48 + 1;
- 48 ÷ 2 = 24 + 0;
- 24 ÷ 2 = 12 + 0;
- 12 ÷ 2 = 6 + 0;
- 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.
3 513 572 480 492 223 984(10) = 11 0000 1100 0010 1011 0111 1000 1110 0010 1000 0101 0011 1011 1101 1111 0000(2)
4. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 62.
- 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) indicates 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, 62,
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.
3 513 572 480 492 223 984(10) = 0011 0000 1100 0010 1011 0111 1000 1110 0010 1000 0101 0011 1011 1101 1111 0000
6. Get the negative integer number representation. Part 1:
- To write the negative integer number on 64 bits (8 Bytes), as a signed binary in one's complement representation, replace all the bits on 0 with 1s and all the bits set on 1 with 0s.
Reverse the digits, flip the digits:
Replace the bits set on 0 with 1s and the bits set on 1 with 0s.
!(0011 0000 1100 0010 1011 0111 1000 1110 0010 1000 0101 0011 1011 1101 1111 0000)
= 1100 1111 0011 1101 0100 1000 0111 0001 1101 0111 1010 1100 0100 0010 0000 1111
7. Get the negative integer number representation. Part 2:
- To write the negative integer number on 64 bits (8 Bytes), as a signed binary in two's complement representation, add 1 to the number calculated above 1100 1111 0011 1101 0100 1000 0111 0001 1101 0111 1010 1100 0100 0010 0000 1111 (to the signed binary in one's complement representation).
Binary addition carries on a value of 2:
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 1 = 10
- 1 + 10 = 11
- 1 + 11 = 100
Add 1 to the number calculated above
(to the signed binary number in one's complement representation):
-3 513 572 480 492 223 984 =
1100 1111 0011 1101 0100 1000 0111 0001 1101 0111 1010 1100 0100 0010 0000 1111 + 1
Decimal Number -3 513 572 480 492 223 984(10) converted to signed binary in two's complement representation:
-3 513 572 480 492 223 984(10) = 1100 1111 0011 1101 0100 1000 0111 0001 1101 0111 1010 1100 0100 0010 0001 0000
Spaces were used to group digits: for binary, by 4, for decimal, by 3.