Convert -578 437 695 752 307 112 to a Signed Binary in Two's (2's) Complement Representation
How to convert decimal number -578 437 695 752 307 112(10) to a signed binary in two's (2's) complement representation
What are the steps to convert decimal number
-578 437 695 752 307 112 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:
|-578 437 695 752 307 112| = 578 437 695 752 307 112
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;
- 578 437 695 752 307 112 ÷ 2 = 289 218 847 876 153 556 + 0;
- 289 218 847 876 153 556 ÷ 2 = 144 609 423 938 076 778 + 0;
- 144 609 423 938 076 778 ÷ 2 = 72 304 711 969 038 389 + 0;
- 72 304 711 969 038 389 ÷ 2 = 36 152 355 984 519 194 + 1;
- 36 152 355 984 519 194 ÷ 2 = 18 076 177 992 259 597 + 0;
- 18 076 177 992 259 597 ÷ 2 = 9 038 088 996 129 798 + 1;
- 9 038 088 996 129 798 ÷ 2 = 4 519 044 498 064 899 + 0;
- 4 519 044 498 064 899 ÷ 2 = 2 259 522 249 032 449 + 1;
- 2 259 522 249 032 449 ÷ 2 = 1 129 761 124 516 224 + 1;
- 1 129 761 124 516 224 ÷ 2 = 564 880 562 258 112 + 0;
- 564 880 562 258 112 ÷ 2 = 282 440 281 129 056 + 0;
- 282 440 281 129 056 ÷ 2 = 141 220 140 564 528 + 0;
- 141 220 140 564 528 ÷ 2 = 70 610 070 282 264 + 0;
- 70 610 070 282 264 ÷ 2 = 35 305 035 141 132 + 0;
- 35 305 035 141 132 ÷ 2 = 17 652 517 570 566 + 0;
- 17 652 517 570 566 ÷ 2 = 8 826 258 785 283 + 0;
- 8 826 258 785 283 ÷ 2 = 4 413 129 392 641 + 1;
- 4 413 129 392 641 ÷ 2 = 2 206 564 696 320 + 1;
- 2 206 564 696 320 ÷ 2 = 1 103 282 348 160 + 0;
- 1 103 282 348 160 ÷ 2 = 551 641 174 080 + 0;
- 551 641 174 080 ÷ 2 = 275 820 587 040 + 0;
- 275 820 587 040 ÷ 2 = 137 910 293 520 + 0;
- 137 910 293 520 ÷ 2 = 68 955 146 760 + 0;
- 68 955 146 760 ÷ 2 = 34 477 573 380 + 0;
- 34 477 573 380 ÷ 2 = 17 238 786 690 + 0;
- 17 238 786 690 ÷ 2 = 8 619 393 345 + 0;
- 8 619 393 345 ÷ 2 = 4 309 696 672 + 1;
- 4 309 696 672 ÷ 2 = 2 154 848 336 + 0;
- 2 154 848 336 ÷ 2 = 1 077 424 168 + 0;
- 1 077 424 168 ÷ 2 = 538 712 084 + 0;
- 538 712 084 ÷ 2 = 269 356 042 + 0;
- 269 356 042 ÷ 2 = 134 678 021 + 0;
- 134 678 021 ÷ 2 = 67 339 010 + 1;
- 67 339 010 ÷ 2 = 33 669 505 + 0;
- 33 669 505 ÷ 2 = 16 834 752 + 1;
- 16 834 752 ÷ 2 = 8 417 376 + 0;
- 8 417 376 ÷ 2 = 4 208 688 + 0;
- 4 208 688 ÷ 2 = 2 104 344 + 0;
- 2 104 344 ÷ 2 = 1 052 172 + 0;
- 1 052 172 ÷ 2 = 526 086 + 0;
- 526 086 ÷ 2 = 263 043 + 0;
- 263 043 ÷ 2 = 131 521 + 1;
- 131 521 ÷ 2 = 65 760 + 1;
- 65 760 ÷ 2 = 32 880 + 0;
- 32 880 ÷ 2 = 16 440 + 0;
- 16 440 ÷ 2 = 8 220 + 0;
- 8 220 ÷ 2 = 4 110 + 0;
- 4 110 ÷ 2 = 2 055 + 0;
- 2 055 ÷ 2 = 1 027 + 1;
- 1 027 ÷ 2 = 513 + 1;
- 513 ÷ 2 = 256 + 1;
- 256 ÷ 2 = 128 + 0;
- 128 ÷ 2 = 64 + 0;
- 64 ÷ 2 = 32 + 0;
- 32 ÷ 2 = 16 + 0;
- 16 ÷ 2 = 8 + 0;
- 8 ÷ 2 = 4 + 0;
- 4 ÷ 2 = 2 + 0;
- 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.
578 437 695 752 307 112(10) = 1000 0000 0111 0000 0110 0000 0101 0000 0100 0000 0011 0000 0001 1010 1000(2)
4. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 60.
- 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, 60,
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.
578 437 695 752 307 112(10) = 0000 1000 0000 0111 0000 0110 0000 0101 0000 0100 0000 0011 0000 0001 1010 1000
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.
!(0000 1000 0000 0111 0000 0110 0000 0101 0000 0100 0000 0011 0000 0001 1010 1000)
= 1111 0111 1111 1000 1111 1001 1111 1010 1111 1011 1111 1100 1111 1110 0101 0111
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 1111 0111 1111 1000 1111 1001 1111 1010 1111 1011 1111 1100 1111 1110 0101 0111 (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):
-578 437 695 752 307 112 =
1111 0111 1111 1000 1111 1001 1111 1010 1111 1011 1111 1100 1111 1110 0101 0111 + 1
Decimal Number -578 437 695 752 307 112(10) converted to signed binary in two's complement representation:
-578 437 695 752 307 112(10) = 1111 0111 1111 1000 1111 1001 1111 1010 1111 1011 1111 1100 1111 1110 0101 1000
Spaces were used to group digits: for binary, by 4, for decimal, by 3.