What are the required steps to convert base 10 integer
number 296 079 836 907 257 104 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;
- 296 079 836 907 257 104 ÷ 2 = 148 039 918 453 628 552 + 0;
- 148 039 918 453 628 552 ÷ 2 = 74 019 959 226 814 276 + 0;
- 74 019 959 226 814 276 ÷ 2 = 37 009 979 613 407 138 + 0;
- 37 009 979 613 407 138 ÷ 2 = 18 504 989 806 703 569 + 0;
- 18 504 989 806 703 569 ÷ 2 = 9 252 494 903 351 784 + 1;
- 9 252 494 903 351 784 ÷ 2 = 4 626 247 451 675 892 + 0;
- 4 626 247 451 675 892 ÷ 2 = 2 313 123 725 837 946 + 0;
- 2 313 123 725 837 946 ÷ 2 = 1 156 561 862 918 973 + 0;
- 1 156 561 862 918 973 ÷ 2 = 578 280 931 459 486 + 1;
- 578 280 931 459 486 ÷ 2 = 289 140 465 729 743 + 0;
- 289 140 465 729 743 ÷ 2 = 144 570 232 864 871 + 1;
- 144 570 232 864 871 ÷ 2 = 72 285 116 432 435 + 1;
- 72 285 116 432 435 ÷ 2 = 36 142 558 216 217 + 1;
- 36 142 558 216 217 ÷ 2 = 18 071 279 108 108 + 1;
- 18 071 279 108 108 ÷ 2 = 9 035 639 554 054 + 0;
- 9 035 639 554 054 ÷ 2 = 4 517 819 777 027 + 0;
- 4 517 819 777 027 ÷ 2 = 2 258 909 888 513 + 1;
- 2 258 909 888 513 ÷ 2 = 1 129 454 944 256 + 1;
- 1 129 454 944 256 ÷ 2 = 564 727 472 128 + 0;
- 564 727 472 128 ÷ 2 = 282 363 736 064 + 0;
- 282 363 736 064 ÷ 2 = 141 181 868 032 + 0;
- 141 181 868 032 ÷ 2 = 70 590 934 016 + 0;
- 70 590 934 016 ÷ 2 = 35 295 467 008 + 0;
- 35 295 467 008 ÷ 2 = 17 647 733 504 + 0;
- 17 647 733 504 ÷ 2 = 8 823 866 752 + 0;
- 8 823 866 752 ÷ 2 = 4 411 933 376 + 0;
- 4 411 933 376 ÷ 2 = 2 205 966 688 + 0;
- 2 205 966 688 ÷ 2 = 1 102 983 344 + 0;
- 1 102 983 344 ÷ 2 = 551 491 672 + 0;
- 551 491 672 ÷ 2 = 275 745 836 + 0;
- 275 745 836 ÷ 2 = 137 872 918 + 0;
- 137 872 918 ÷ 2 = 68 936 459 + 0;
- 68 936 459 ÷ 2 = 34 468 229 + 1;
- 34 468 229 ÷ 2 = 17 234 114 + 1;
- 17 234 114 ÷ 2 = 8 617 057 + 0;
- 8 617 057 ÷ 2 = 4 308 528 + 1;
- 4 308 528 ÷ 2 = 2 154 264 + 0;
- 2 154 264 ÷ 2 = 1 077 132 + 0;
- 1 077 132 ÷ 2 = 538 566 + 0;
- 538 566 ÷ 2 = 269 283 + 0;
- 269 283 ÷ 2 = 134 641 + 1;
- 134 641 ÷ 2 = 67 320 + 1;
- 67 320 ÷ 2 = 33 660 + 0;
- 33 660 ÷ 2 = 16 830 + 0;
- 16 830 ÷ 2 = 8 415 + 0;
- 8 415 ÷ 2 = 4 207 + 1;
- 4 207 ÷ 2 = 2 103 + 1;
- 2 103 ÷ 2 = 1 051 + 1;
- 1 051 ÷ 2 = 525 + 1;
- 525 ÷ 2 = 262 + 1;
- 262 ÷ 2 = 131 + 0;
- 131 ÷ 2 = 65 + 1;
- 65 ÷ 2 = 32 + 1;
- 32 ÷ 2 = 16 + 0;
- 16 ÷ 2 = 8 + 0;
- 8 ÷ 2 = 4 + 0;
- 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.
296 079 836 907 257 104(10) = 100 0001 1011 1110 0011 0000 1011 0000 0000 0000 0011 0011 1101 0001 0000(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:
296 079 836 907 257 104(10) Base 10 integer number converted and written as a signed binary code (in base 2):
296 079 836 907 257 104(10) = 0000 0100 0001 1011 1110 0011 0000 1011 0000 0000 0000 0011 0011 1101 0001 0000
Spaces were used to group digits: for binary, by 4, for decimal, by 3.