Convert -2 049 638 230 412 172 426 to a Signed Binary in Two's (2's) Complement Representation
How to convert decimal number -2 049 638 230 412 172 426(10) to a signed binary in two's (2's) complement representation
What are the steps to convert decimal number
-2 049 638 230 412 172 426 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:
|-2 049 638 230 412 172 426| = 2 049 638 230 412 172 426
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;
- 2 049 638 230 412 172 426 ÷ 2 = 1 024 819 115 206 086 213 + 0;
- 1 024 819 115 206 086 213 ÷ 2 = 512 409 557 603 043 106 + 1;
- 512 409 557 603 043 106 ÷ 2 = 256 204 778 801 521 553 + 0;
- 256 204 778 801 521 553 ÷ 2 = 128 102 389 400 760 776 + 1;
- 128 102 389 400 760 776 ÷ 2 = 64 051 194 700 380 388 + 0;
- 64 051 194 700 380 388 ÷ 2 = 32 025 597 350 190 194 + 0;
- 32 025 597 350 190 194 ÷ 2 = 16 012 798 675 095 097 + 0;
- 16 012 798 675 095 097 ÷ 2 = 8 006 399 337 547 548 + 1;
- 8 006 399 337 547 548 ÷ 2 = 4 003 199 668 773 774 + 0;
- 4 003 199 668 773 774 ÷ 2 = 2 001 599 834 386 887 + 0;
- 2 001 599 834 386 887 ÷ 2 = 1 000 799 917 193 443 + 1;
- 1 000 799 917 193 443 ÷ 2 = 500 399 958 596 721 + 1;
- 500 399 958 596 721 ÷ 2 = 250 199 979 298 360 + 1;
- 250 199 979 298 360 ÷ 2 = 125 099 989 649 180 + 0;
- 125 099 989 649 180 ÷ 2 = 62 549 994 824 590 + 0;
- 62 549 994 824 590 ÷ 2 = 31 274 997 412 295 + 0;
- 31 274 997 412 295 ÷ 2 = 15 637 498 706 147 + 1;
- 15 637 498 706 147 ÷ 2 = 7 818 749 353 073 + 1;
- 7 818 749 353 073 ÷ 2 = 3 909 374 676 536 + 1;
- 3 909 374 676 536 ÷ 2 = 1 954 687 338 268 + 0;
- 1 954 687 338 268 ÷ 2 = 977 343 669 134 + 0;
- 977 343 669 134 ÷ 2 = 488 671 834 567 + 0;
- 488 671 834 567 ÷ 2 = 244 335 917 283 + 1;
- 244 335 917 283 ÷ 2 = 122 167 958 641 + 1;
- 122 167 958 641 ÷ 2 = 61 083 979 320 + 1;
- 61 083 979 320 ÷ 2 = 30 541 989 660 + 0;
- 30 541 989 660 ÷ 2 = 15 270 994 830 + 0;
- 15 270 994 830 ÷ 2 = 7 635 497 415 + 0;
- 7 635 497 415 ÷ 2 = 3 817 748 707 + 1;
- 3 817 748 707 ÷ 2 = 1 908 874 353 + 1;
- 1 908 874 353 ÷ 2 = 954 437 176 + 1;
- 954 437 176 ÷ 2 = 477 218 588 + 0;
- 477 218 588 ÷ 2 = 238 609 294 + 0;
- 238 609 294 ÷ 2 = 119 304 647 + 0;
- 119 304 647 ÷ 2 = 59 652 323 + 1;
- 59 652 323 ÷ 2 = 29 826 161 + 1;
- 29 826 161 ÷ 2 = 14 913 080 + 1;
- 14 913 080 ÷ 2 = 7 456 540 + 0;
- 7 456 540 ÷ 2 = 3 728 270 + 0;
- 3 728 270 ÷ 2 = 1 864 135 + 0;
- 1 864 135 ÷ 2 = 932 067 + 1;
- 932 067 ÷ 2 = 466 033 + 1;
- 466 033 ÷ 2 = 233 016 + 1;
- 233 016 ÷ 2 = 116 508 + 0;
- 116 508 ÷ 2 = 58 254 + 0;
- 58 254 ÷ 2 = 29 127 + 0;
- 29 127 ÷ 2 = 14 563 + 1;
- 14 563 ÷ 2 = 7 281 + 1;
- 7 281 ÷ 2 = 3 640 + 1;
- 3 640 ÷ 2 = 1 820 + 0;
- 1 820 ÷ 2 = 910 + 0;
- 910 ÷ 2 = 455 + 0;
- 455 ÷ 2 = 227 + 1;
- 227 ÷ 2 = 113 + 1;
- 113 ÷ 2 = 56 + 1;
- 56 ÷ 2 = 28 + 0;
- 28 ÷ 2 = 14 + 0;
- 14 ÷ 2 = 7 + 0;
- 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.
2 049 638 230 412 172 426(10) = 1 1100 0111 0001 1100 0111 0001 1100 0111 0001 1100 0111 0001 1100 1000 1010(2)
4. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 61.
- 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, 61,
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.
2 049 638 230 412 172 426(10) = 0001 1100 0111 0001 1100 0111 0001 1100 0111 0001 1100 0111 0001 1100 1000 1010
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.
!(0001 1100 0111 0001 1100 0111 0001 1100 0111 0001 1100 0111 0001 1100 1000 1010)
= 1110 0011 1000 1110 0011 1000 1110 0011 1000 1110 0011 1000 1110 0011 0111 0101
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 1110 0011 1000 1110 0011 1000 1110 0011 1000 1110 0011 1000 1110 0011 0111 0101 (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):
-2 049 638 230 412 172 426 =
1110 0011 1000 1110 0011 1000 1110 0011 1000 1110 0011 1000 1110 0011 0111 0101 + 1
Decimal Number -2 049 638 230 412 172 426(10) converted to signed binary in two's complement representation:
-2 049 638 230 412 172 426(10) = 1110 0011 1000 1110 0011 1000 1110 0011 1000 1110 0011 1000 1110 0011 0111 0110
Spaces were used to group digits: for binary, by 4, for decimal, by 3.