What are the required steps to convert base 10 integer
number 202 200 701 709 538 541 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. 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;
- 202 200 701 709 538 541 ÷ 2 = 101 100 350 854 769 270 + 1;
- 101 100 350 854 769 270 ÷ 2 = 50 550 175 427 384 635 + 0;
- 50 550 175 427 384 635 ÷ 2 = 25 275 087 713 692 317 + 1;
- 25 275 087 713 692 317 ÷ 2 = 12 637 543 856 846 158 + 1;
- 12 637 543 856 846 158 ÷ 2 = 6 318 771 928 423 079 + 0;
- 6 318 771 928 423 079 ÷ 2 = 3 159 385 964 211 539 + 1;
- 3 159 385 964 211 539 ÷ 2 = 1 579 692 982 105 769 + 1;
- 1 579 692 982 105 769 ÷ 2 = 789 846 491 052 884 + 1;
- 789 846 491 052 884 ÷ 2 = 394 923 245 526 442 + 0;
- 394 923 245 526 442 ÷ 2 = 197 461 622 763 221 + 0;
- 197 461 622 763 221 ÷ 2 = 98 730 811 381 610 + 1;
- 98 730 811 381 610 ÷ 2 = 49 365 405 690 805 + 0;
- 49 365 405 690 805 ÷ 2 = 24 682 702 845 402 + 1;
- 24 682 702 845 402 ÷ 2 = 12 341 351 422 701 + 0;
- 12 341 351 422 701 ÷ 2 = 6 170 675 711 350 + 1;
- 6 170 675 711 350 ÷ 2 = 3 085 337 855 675 + 0;
- 3 085 337 855 675 ÷ 2 = 1 542 668 927 837 + 1;
- 1 542 668 927 837 ÷ 2 = 771 334 463 918 + 1;
- 771 334 463 918 ÷ 2 = 385 667 231 959 + 0;
- 385 667 231 959 ÷ 2 = 192 833 615 979 + 1;
- 192 833 615 979 ÷ 2 = 96 416 807 989 + 1;
- 96 416 807 989 ÷ 2 = 48 208 403 994 + 1;
- 48 208 403 994 ÷ 2 = 24 104 201 997 + 0;
- 24 104 201 997 ÷ 2 = 12 052 100 998 + 1;
- 12 052 100 998 ÷ 2 = 6 026 050 499 + 0;
- 6 026 050 499 ÷ 2 = 3 013 025 249 + 1;
- 3 013 025 249 ÷ 2 = 1 506 512 624 + 1;
- 1 506 512 624 ÷ 2 = 753 256 312 + 0;
- 753 256 312 ÷ 2 = 376 628 156 + 0;
- 376 628 156 ÷ 2 = 188 314 078 + 0;
- 188 314 078 ÷ 2 = 94 157 039 + 0;
- 94 157 039 ÷ 2 = 47 078 519 + 1;
- 47 078 519 ÷ 2 = 23 539 259 + 1;
- 23 539 259 ÷ 2 = 11 769 629 + 1;
- 11 769 629 ÷ 2 = 5 884 814 + 1;
- 5 884 814 ÷ 2 = 2 942 407 + 0;
- 2 942 407 ÷ 2 = 1 471 203 + 1;
- 1 471 203 ÷ 2 = 735 601 + 1;
- 735 601 ÷ 2 = 367 800 + 1;
- 367 800 ÷ 2 = 183 900 + 0;
- 183 900 ÷ 2 = 91 950 + 0;
- 91 950 ÷ 2 = 45 975 + 0;
- 45 975 ÷ 2 = 22 987 + 1;
- 22 987 ÷ 2 = 11 493 + 1;
- 11 493 ÷ 2 = 5 746 + 1;
- 5 746 ÷ 2 = 2 873 + 0;
- 2 873 ÷ 2 = 1 436 + 1;
- 1 436 ÷ 2 = 718 + 0;
- 718 ÷ 2 = 359 + 0;
- 359 ÷ 2 = 179 + 1;
- 179 ÷ 2 = 89 + 1;
- 89 ÷ 2 = 44 + 1;
- 44 ÷ 2 = 22 + 0;
- 22 ÷ 2 = 11 + 0;
- 11 ÷ 2 = 5 + 1;
- 5 ÷ 2 = 2 + 1;
- 2 ÷ 2 = 1 + 0;
- 1 ÷ 2 = 0 + 1;
2. Construct the base 2 representation of the positive number:
Take all the remainders starting from the bottom of the list constructed above.
202 200 701 709 538 541(10) = 10 1100 1110 0101 1100 0111 0111 1000 0110 1011 1011 0101 0100 1110 1101(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 58.
- 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, 58,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 64.
4. 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:
202 200 701 709 538 541(10) Base 10 integer number converted and written as a signed binary code (in base 2):
202 200 701 709 538 541(10) = 0000 0010 1100 1110 0101 1100 0111 0111 1000 0110 1011 1011 0101 0100 1110 1101
Spaces were used to group digits: for binary, by 4, for decimal, by 3.