What are the required steps to convert base 10 integer
number 46 564 611 064 646 901 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;
- 46 564 611 064 646 901 ÷ 2 = 23 282 305 532 323 450 + 1;
- 23 282 305 532 323 450 ÷ 2 = 11 641 152 766 161 725 + 0;
- 11 641 152 766 161 725 ÷ 2 = 5 820 576 383 080 862 + 1;
- 5 820 576 383 080 862 ÷ 2 = 2 910 288 191 540 431 + 0;
- 2 910 288 191 540 431 ÷ 2 = 1 455 144 095 770 215 + 1;
- 1 455 144 095 770 215 ÷ 2 = 727 572 047 885 107 + 1;
- 727 572 047 885 107 ÷ 2 = 363 786 023 942 553 + 1;
- 363 786 023 942 553 ÷ 2 = 181 893 011 971 276 + 1;
- 181 893 011 971 276 ÷ 2 = 90 946 505 985 638 + 0;
- 90 946 505 985 638 ÷ 2 = 45 473 252 992 819 + 0;
- 45 473 252 992 819 ÷ 2 = 22 736 626 496 409 + 1;
- 22 736 626 496 409 ÷ 2 = 11 368 313 248 204 + 1;
- 11 368 313 248 204 ÷ 2 = 5 684 156 624 102 + 0;
- 5 684 156 624 102 ÷ 2 = 2 842 078 312 051 + 0;
- 2 842 078 312 051 ÷ 2 = 1 421 039 156 025 + 1;
- 1 421 039 156 025 ÷ 2 = 710 519 578 012 + 1;
- 710 519 578 012 ÷ 2 = 355 259 789 006 + 0;
- 355 259 789 006 ÷ 2 = 177 629 894 503 + 0;
- 177 629 894 503 ÷ 2 = 88 814 947 251 + 1;
- 88 814 947 251 ÷ 2 = 44 407 473 625 + 1;
- 44 407 473 625 ÷ 2 = 22 203 736 812 + 1;
- 22 203 736 812 ÷ 2 = 11 101 868 406 + 0;
- 11 101 868 406 ÷ 2 = 5 550 934 203 + 0;
- 5 550 934 203 ÷ 2 = 2 775 467 101 + 1;
- 2 775 467 101 ÷ 2 = 1 387 733 550 + 1;
- 1 387 733 550 ÷ 2 = 693 866 775 + 0;
- 693 866 775 ÷ 2 = 346 933 387 + 1;
- 346 933 387 ÷ 2 = 173 466 693 + 1;
- 173 466 693 ÷ 2 = 86 733 346 + 1;
- 86 733 346 ÷ 2 = 43 366 673 + 0;
- 43 366 673 ÷ 2 = 21 683 336 + 1;
- 21 683 336 ÷ 2 = 10 841 668 + 0;
- 10 841 668 ÷ 2 = 5 420 834 + 0;
- 5 420 834 ÷ 2 = 2 710 417 + 0;
- 2 710 417 ÷ 2 = 1 355 208 + 1;
- 1 355 208 ÷ 2 = 677 604 + 0;
- 677 604 ÷ 2 = 338 802 + 0;
- 338 802 ÷ 2 = 169 401 + 0;
- 169 401 ÷ 2 = 84 700 + 1;
- 84 700 ÷ 2 = 42 350 + 0;
- 42 350 ÷ 2 = 21 175 + 0;
- 21 175 ÷ 2 = 10 587 + 1;
- 10 587 ÷ 2 = 5 293 + 1;
- 5 293 ÷ 2 = 2 646 + 1;
- 2 646 ÷ 2 = 1 323 + 0;
- 1 323 ÷ 2 = 661 + 1;
- 661 ÷ 2 = 330 + 1;
- 330 ÷ 2 = 165 + 0;
- 165 ÷ 2 = 82 + 1;
- 82 ÷ 2 = 41 + 0;
- 41 ÷ 2 = 20 + 1;
- 20 ÷ 2 = 10 + 0;
- 10 ÷ 2 = 5 + 0;
- 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.
46 564 611 064 646 901(10) = 1010 0101 0110 1110 0100 0100 0101 1101 1001 1100 1100 1100 1111 0101(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 56.
- 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, 56,
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:
46 564 611 064 646 901(10) Base 10 integer number converted and written as a signed binary code (in base 2):
46 564 611 064 646 901(10) = 0000 0000 1010 0101 0110 1110 0100 0100 0101 1101 1001 1100 1100 1100 1111 0101
Spaces were used to group digits: for binary, by 4, for decimal, by 3.