What are the required steps to convert base 10 integer
number 3 434 349 076 429 689 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;
- 3 434 349 076 429 689 ÷ 2 = 1 717 174 538 214 844 + 1;
- 1 717 174 538 214 844 ÷ 2 = 858 587 269 107 422 + 0;
- 858 587 269 107 422 ÷ 2 = 429 293 634 553 711 + 0;
- 429 293 634 553 711 ÷ 2 = 214 646 817 276 855 + 1;
- 214 646 817 276 855 ÷ 2 = 107 323 408 638 427 + 1;
- 107 323 408 638 427 ÷ 2 = 53 661 704 319 213 + 1;
- 53 661 704 319 213 ÷ 2 = 26 830 852 159 606 + 1;
- 26 830 852 159 606 ÷ 2 = 13 415 426 079 803 + 0;
- 13 415 426 079 803 ÷ 2 = 6 707 713 039 901 + 1;
- 6 707 713 039 901 ÷ 2 = 3 353 856 519 950 + 1;
- 3 353 856 519 950 ÷ 2 = 1 676 928 259 975 + 0;
- 1 676 928 259 975 ÷ 2 = 838 464 129 987 + 1;
- 838 464 129 987 ÷ 2 = 419 232 064 993 + 1;
- 419 232 064 993 ÷ 2 = 209 616 032 496 + 1;
- 209 616 032 496 ÷ 2 = 104 808 016 248 + 0;
- 104 808 016 248 ÷ 2 = 52 404 008 124 + 0;
- 52 404 008 124 ÷ 2 = 26 202 004 062 + 0;
- 26 202 004 062 ÷ 2 = 13 101 002 031 + 0;
- 13 101 002 031 ÷ 2 = 6 550 501 015 + 1;
- 6 550 501 015 ÷ 2 = 3 275 250 507 + 1;
- 3 275 250 507 ÷ 2 = 1 637 625 253 + 1;
- 1 637 625 253 ÷ 2 = 818 812 626 + 1;
- 818 812 626 ÷ 2 = 409 406 313 + 0;
- 409 406 313 ÷ 2 = 204 703 156 + 1;
- 204 703 156 ÷ 2 = 102 351 578 + 0;
- 102 351 578 ÷ 2 = 51 175 789 + 0;
- 51 175 789 ÷ 2 = 25 587 894 + 1;
- 25 587 894 ÷ 2 = 12 793 947 + 0;
- 12 793 947 ÷ 2 = 6 396 973 + 1;
- 6 396 973 ÷ 2 = 3 198 486 + 1;
- 3 198 486 ÷ 2 = 1 599 243 + 0;
- 1 599 243 ÷ 2 = 799 621 + 1;
- 799 621 ÷ 2 = 399 810 + 1;
- 399 810 ÷ 2 = 199 905 + 0;
- 199 905 ÷ 2 = 99 952 + 1;
- 99 952 ÷ 2 = 49 976 + 0;
- 49 976 ÷ 2 = 24 988 + 0;
- 24 988 ÷ 2 = 12 494 + 0;
- 12 494 ÷ 2 = 6 247 + 0;
- 6 247 ÷ 2 = 3 123 + 1;
- 3 123 ÷ 2 = 1 561 + 1;
- 1 561 ÷ 2 = 780 + 1;
- 780 ÷ 2 = 390 + 0;
- 390 ÷ 2 = 195 + 0;
- 195 ÷ 2 = 97 + 1;
- 97 ÷ 2 = 48 + 1;
- 48 ÷ 2 = 24 + 0;
- 24 ÷ 2 = 12 + 0;
- 12 ÷ 2 = 6 + 0;
- 6 ÷ 2 = 3 + 0;
- 3 ÷ 2 = 1 + 1;
- 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.
3 434 349 076 429 689(10) = 1100 0011 0011 1000 0101 1011 0100 1011 1100 0011 1011 0111 1001(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 52.
- 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, 52,
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:
3 434 349 076 429 689(10) Base 10 integer number converted and written as a signed binary code (in base 2):
3 434 349 076 429 689(10) = 0000 0000 0000 1100 0011 0011 1000 0101 1011 0100 1011 1100 0011 1011 0111 1001
Spaces were used to group digits: for binary, by 4, for decimal, by 3.