Convert -4 413 527 634 823 086 079 to a Signed Binary in Two's (2's) Complement Representation
How to convert decimal number -4 413 527 634 823 086 079(10) to a signed binary in two's (2's) complement representation
What are the steps to convert decimal number
-4 413 527 634 823 086 079 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:
|-4 413 527 634 823 086 079| = 4 413 527 634 823 086 079
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;
- 4 413 527 634 823 086 079 ÷ 2 = 2 206 763 817 411 543 039 + 1;
- 2 206 763 817 411 543 039 ÷ 2 = 1 103 381 908 705 771 519 + 1;
- 1 103 381 908 705 771 519 ÷ 2 = 551 690 954 352 885 759 + 1;
- 551 690 954 352 885 759 ÷ 2 = 275 845 477 176 442 879 + 1;
- 275 845 477 176 442 879 ÷ 2 = 137 922 738 588 221 439 + 1;
- 137 922 738 588 221 439 ÷ 2 = 68 961 369 294 110 719 + 1;
- 68 961 369 294 110 719 ÷ 2 = 34 480 684 647 055 359 + 1;
- 34 480 684 647 055 359 ÷ 2 = 17 240 342 323 527 679 + 1;
- 17 240 342 323 527 679 ÷ 2 = 8 620 171 161 763 839 + 1;
- 8 620 171 161 763 839 ÷ 2 = 4 310 085 580 881 919 + 1;
- 4 310 085 580 881 919 ÷ 2 = 2 155 042 790 440 959 + 1;
- 2 155 042 790 440 959 ÷ 2 = 1 077 521 395 220 479 + 1;
- 1 077 521 395 220 479 ÷ 2 = 538 760 697 610 239 + 1;
- 538 760 697 610 239 ÷ 2 = 269 380 348 805 119 + 1;
- 269 380 348 805 119 ÷ 2 = 134 690 174 402 559 + 1;
- 134 690 174 402 559 ÷ 2 = 67 345 087 201 279 + 1;
- 67 345 087 201 279 ÷ 2 = 33 672 543 600 639 + 1;
- 33 672 543 600 639 ÷ 2 = 16 836 271 800 319 + 1;
- 16 836 271 800 319 ÷ 2 = 8 418 135 900 159 + 1;
- 8 418 135 900 159 ÷ 2 = 4 209 067 950 079 + 1;
- 4 209 067 950 079 ÷ 2 = 2 104 533 975 039 + 1;
- 2 104 533 975 039 ÷ 2 = 1 052 266 987 519 + 1;
- 1 052 266 987 519 ÷ 2 = 526 133 493 759 + 1;
- 526 133 493 759 ÷ 2 = 263 066 746 879 + 1;
- 263 066 746 879 ÷ 2 = 131 533 373 439 + 1;
- 131 533 373 439 ÷ 2 = 65 766 686 719 + 1;
- 65 766 686 719 ÷ 2 = 32 883 343 359 + 1;
- 32 883 343 359 ÷ 2 = 16 441 671 679 + 1;
- 16 441 671 679 ÷ 2 = 8 220 835 839 + 1;
- 8 220 835 839 ÷ 2 = 4 110 417 919 + 1;
- 4 110 417 919 ÷ 2 = 2 055 208 959 + 1;
- 2 055 208 959 ÷ 2 = 1 027 604 479 + 1;
- 1 027 604 479 ÷ 2 = 513 802 239 + 1;
- 513 802 239 ÷ 2 = 256 901 119 + 1;
- 256 901 119 ÷ 2 = 128 450 559 + 1;
- 128 450 559 ÷ 2 = 64 225 279 + 1;
- 64 225 279 ÷ 2 = 32 112 639 + 1;
- 32 112 639 ÷ 2 = 16 056 319 + 1;
- 16 056 319 ÷ 2 = 8 028 159 + 1;
- 8 028 159 ÷ 2 = 4 014 079 + 1;
- 4 014 079 ÷ 2 = 2 007 039 + 1;
- 2 007 039 ÷ 2 = 1 003 519 + 1;
- 1 003 519 ÷ 2 = 501 759 + 1;
- 501 759 ÷ 2 = 250 879 + 1;
- 250 879 ÷ 2 = 125 439 + 1;
- 125 439 ÷ 2 = 62 719 + 1;
- 62 719 ÷ 2 = 31 359 + 1;
- 31 359 ÷ 2 = 15 679 + 1;
- 15 679 ÷ 2 = 7 839 + 1;
- 7 839 ÷ 2 = 3 919 + 1;
- 3 919 ÷ 2 = 1 959 + 1;
- 1 959 ÷ 2 = 979 + 1;
- 979 ÷ 2 = 489 + 1;
- 489 ÷ 2 = 244 + 1;
- 244 ÷ 2 = 122 + 0;
- 122 ÷ 2 = 61 + 0;
- 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.
4 413 527 634 823 086 079(10) = 11 1101 0011 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111(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.
4 413 527 634 823 086 079(10) = 0011 1101 0011 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111
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 1101 0011 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111)
= 1100 0010 1100 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
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 0010 1100 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 (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):
-4 413 527 634 823 086 079 =
1100 0010 1100 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 + 1
Decimal Number -4 413 527 634 823 086 079(10) converted to signed binary in two's complement representation:
-4 413 527 634 823 086 079(10) = 1100 0010 1100 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001
Spaces were used to group digits: for binary, by 4, for decimal, by 3.