What are the required steps to convert base 10 integer
number 333 333 333 333 333 546 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;
- 333 333 333 333 333 546 ÷ 2 = 166 666 666 666 666 773 + 0;
- 166 666 666 666 666 773 ÷ 2 = 83 333 333 333 333 386 + 1;
- 83 333 333 333 333 386 ÷ 2 = 41 666 666 666 666 693 + 0;
- 41 666 666 666 666 693 ÷ 2 = 20 833 333 333 333 346 + 1;
- 20 833 333 333 333 346 ÷ 2 = 10 416 666 666 666 673 + 0;
- 10 416 666 666 666 673 ÷ 2 = 5 208 333 333 333 336 + 1;
- 5 208 333 333 333 336 ÷ 2 = 2 604 166 666 666 668 + 0;
- 2 604 166 666 666 668 ÷ 2 = 1 302 083 333 333 334 + 0;
- 1 302 083 333 333 334 ÷ 2 = 651 041 666 666 667 + 0;
- 651 041 666 666 667 ÷ 2 = 325 520 833 333 333 + 1;
- 325 520 833 333 333 ÷ 2 = 162 760 416 666 666 + 1;
- 162 760 416 666 666 ÷ 2 = 81 380 208 333 333 + 0;
- 81 380 208 333 333 ÷ 2 = 40 690 104 166 666 + 1;
- 40 690 104 166 666 ÷ 2 = 20 345 052 083 333 + 0;
- 20 345 052 083 333 ÷ 2 = 10 172 526 041 666 + 1;
- 10 172 526 041 666 ÷ 2 = 5 086 263 020 833 + 0;
- 5 086 263 020 833 ÷ 2 = 2 543 131 510 416 + 1;
- 2 543 131 510 416 ÷ 2 = 1 271 565 755 208 + 0;
- 1 271 565 755 208 ÷ 2 = 635 782 877 604 + 0;
- 635 782 877 604 ÷ 2 = 317 891 438 802 + 0;
- 317 891 438 802 ÷ 2 = 158 945 719 401 + 0;
- 158 945 719 401 ÷ 2 = 79 472 859 700 + 1;
- 79 472 859 700 ÷ 2 = 39 736 429 850 + 0;
- 39 736 429 850 ÷ 2 = 19 868 214 925 + 0;
- 19 868 214 925 ÷ 2 = 9 934 107 462 + 1;
- 9 934 107 462 ÷ 2 = 4 967 053 731 + 0;
- 4 967 053 731 ÷ 2 = 2 483 526 865 + 1;
- 2 483 526 865 ÷ 2 = 1 241 763 432 + 1;
- 1 241 763 432 ÷ 2 = 620 881 716 + 0;
- 620 881 716 ÷ 2 = 310 440 858 + 0;
- 310 440 858 ÷ 2 = 155 220 429 + 0;
- 155 220 429 ÷ 2 = 77 610 214 + 1;
- 77 610 214 ÷ 2 = 38 805 107 + 0;
- 38 805 107 ÷ 2 = 19 402 553 + 1;
- 19 402 553 ÷ 2 = 9 701 276 + 1;
- 9 701 276 ÷ 2 = 4 850 638 + 0;
- 4 850 638 ÷ 2 = 2 425 319 + 0;
- 2 425 319 ÷ 2 = 1 212 659 + 1;
- 1 212 659 ÷ 2 = 606 329 + 1;
- 606 329 ÷ 2 = 303 164 + 1;
- 303 164 ÷ 2 = 151 582 + 0;
- 151 582 ÷ 2 = 75 791 + 0;
- 75 791 ÷ 2 = 37 895 + 1;
- 37 895 ÷ 2 = 18 947 + 1;
- 18 947 ÷ 2 = 9 473 + 1;
- 9 473 ÷ 2 = 4 736 + 1;
- 4 736 ÷ 2 = 2 368 + 0;
- 2 368 ÷ 2 = 1 184 + 0;
- 1 184 ÷ 2 = 592 + 0;
- 592 ÷ 2 = 296 + 0;
- 296 ÷ 2 = 148 + 0;
- 148 ÷ 2 = 74 + 0;
- 74 ÷ 2 = 37 + 0;
- 37 ÷ 2 = 18 + 1;
- 18 ÷ 2 = 9 + 0;
- 9 ÷ 2 = 4 + 1;
- 4 ÷ 2 = 2 + 0;
- 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.
333 333 333 333 333 546(10) = 100 1010 0000 0011 1100 1110 0110 1000 1101 0010 0001 0101 0110 0010 1010(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 59.
- 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, 59,
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:
333 333 333 333 333 546(10) Base 10 integer number converted and written as a signed binary code (in base 2):
333 333 333 333 333 546(10) = 0000 0100 1010 0000 0011 1100 1110 0110 1000 1101 0010 0001 0101 0110 0010 1010
Spaces were used to group digits: for binary, by 4, for decimal, by 3.