What are the required steps to convert base 10 integer
number -731 199 020 484 759 508 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:
|-731 199 020 484 759 508| = 731 199 020 484 759 508
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;
- 731 199 020 484 759 508 ÷ 2 = 365 599 510 242 379 754 + 0;
- 365 599 510 242 379 754 ÷ 2 = 182 799 755 121 189 877 + 0;
- 182 799 755 121 189 877 ÷ 2 = 91 399 877 560 594 938 + 1;
- 91 399 877 560 594 938 ÷ 2 = 45 699 938 780 297 469 + 0;
- 45 699 938 780 297 469 ÷ 2 = 22 849 969 390 148 734 + 1;
- 22 849 969 390 148 734 ÷ 2 = 11 424 984 695 074 367 + 0;
- 11 424 984 695 074 367 ÷ 2 = 5 712 492 347 537 183 + 1;
- 5 712 492 347 537 183 ÷ 2 = 2 856 246 173 768 591 + 1;
- 2 856 246 173 768 591 ÷ 2 = 1 428 123 086 884 295 + 1;
- 1 428 123 086 884 295 ÷ 2 = 714 061 543 442 147 + 1;
- 714 061 543 442 147 ÷ 2 = 357 030 771 721 073 + 1;
- 357 030 771 721 073 ÷ 2 = 178 515 385 860 536 + 1;
- 178 515 385 860 536 ÷ 2 = 89 257 692 930 268 + 0;
- 89 257 692 930 268 ÷ 2 = 44 628 846 465 134 + 0;
- 44 628 846 465 134 ÷ 2 = 22 314 423 232 567 + 0;
- 22 314 423 232 567 ÷ 2 = 11 157 211 616 283 + 1;
- 11 157 211 616 283 ÷ 2 = 5 578 605 808 141 + 1;
- 5 578 605 808 141 ÷ 2 = 2 789 302 904 070 + 1;
- 2 789 302 904 070 ÷ 2 = 1 394 651 452 035 + 0;
- 1 394 651 452 035 ÷ 2 = 697 325 726 017 + 1;
- 697 325 726 017 ÷ 2 = 348 662 863 008 + 1;
- 348 662 863 008 ÷ 2 = 174 331 431 504 + 0;
- 174 331 431 504 ÷ 2 = 87 165 715 752 + 0;
- 87 165 715 752 ÷ 2 = 43 582 857 876 + 0;
- 43 582 857 876 ÷ 2 = 21 791 428 938 + 0;
- 21 791 428 938 ÷ 2 = 10 895 714 469 + 0;
- 10 895 714 469 ÷ 2 = 5 447 857 234 + 1;
- 5 447 857 234 ÷ 2 = 2 723 928 617 + 0;
- 2 723 928 617 ÷ 2 = 1 361 964 308 + 1;
- 1 361 964 308 ÷ 2 = 680 982 154 + 0;
- 680 982 154 ÷ 2 = 340 491 077 + 0;
- 340 491 077 ÷ 2 = 170 245 538 + 1;
- 170 245 538 ÷ 2 = 85 122 769 + 0;
- 85 122 769 ÷ 2 = 42 561 384 + 1;
- 42 561 384 ÷ 2 = 21 280 692 + 0;
- 21 280 692 ÷ 2 = 10 640 346 + 0;
- 10 640 346 ÷ 2 = 5 320 173 + 0;
- 5 320 173 ÷ 2 = 2 660 086 + 1;
- 2 660 086 ÷ 2 = 1 330 043 + 0;
- 1 330 043 ÷ 2 = 665 021 + 1;
- 665 021 ÷ 2 = 332 510 + 1;
- 332 510 ÷ 2 = 166 255 + 0;
- 166 255 ÷ 2 = 83 127 + 1;
- 83 127 ÷ 2 = 41 563 + 1;
- 41 563 ÷ 2 = 20 781 + 1;
- 20 781 ÷ 2 = 10 390 + 1;
- 10 390 ÷ 2 = 5 195 + 0;
- 5 195 ÷ 2 = 2 597 + 1;
- 2 597 ÷ 2 = 1 298 + 1;
- 1 298 ÷ 2 = 649 + 0;
- 649 ÷ 2 = 324 + 1;
- 324 ÷ 2 = 162 + 0;
- 162 ÷ 2 = 81 + 0;
- 81 ÷ 2 = 40 + 1;
- 40 ÷ 2 = 20 + 0;
- 20 ÷ 2 = 10 + 0;
- 10 ÷ 2 = 5 + 0;
- 5 ÷ 2 = 2 + 1;
- 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.
731 199 020 484 759 508(10) = 1010 0010 0101 1011 1101 1010 0010 1001 0100 0001 1011 1000 1111 1101 0100(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) 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, 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:
731 199 020 484 759 508(10) = 0000 1010 0010 0101 1011 1101 1010 0010 1001 0100 0001 1011 1000 1111 1101 0100
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...
-731 199 020 484 759 508(10) Base 10 integer number converted and written as a signed binary code (in base 2):
-731 199 020 484 759 508(10) = 1000 1010 0010 0101 1011 1101 1010 0010 1001 0100 0001 1011 1000 1111 1101 0100
Spaces were used to group digits: for binary, by 4, for decimal, by 3.