What are the required steps to convert base 10 integer
number 1 101 101 010 100 111 259 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;
- 1 101 101 010 100 111 259 ÷ 2 = 550 550 505 050 055 629 + 1;
- 550 550 505 050 055 629 ÷ 2 = 275 275 252 525 027 814 + 1;
- 275 275 252 525 027 814 ÷ 2 = 137 637 626 262 513 907 + 0;
- 137 637 626 262 513 907 ÷ 2 = 68 818 813 131 256 953 + 1;
- 68 818 813 131 256 953 ÷ 2 = 34 409 406 565 628 476 + 1;
- 34 409 406 565 628 476 ÷ 2 = 17 204 703 282 814 238 + 0;
- 17 204 703 282 814 238 ÷ 2 = 8 602 351 641 407 119 + 0;
- 8 602 351 641 407 119 ÷ 2 = 4 301 175 820 703 559 + 1;
- 4 301 175 820 703 559 ÷ 2 = 2 150 587 910 351 779 + 1;
- 2 150 587 910 351 779 ÷ 2 = 1 075 293 955 175 889 + 1;
- 1 075 293 955 175 889 ÷ 2 = 537 646 977 587 944 + 1;
- 537 646 977 587 944 ÷ 2 = 268 823 488 793 972 + 0;
- 268 823 488 793 972 ÷ 2 = 134 411 744 396 986 + 0;
- 134 411 744 396 986 ÷ 2 = 67 205 872 198 493 + 0;
- 67 205 872 198 493 ÷ 2 = 33 602 936 099 246 + 1;
- 33 602 936 099 246 ÷ 2 = 16 801 468 049 623 + 0;
- 16 801 468 049 623 ÷ 2 = 8 400 734 024 811 + 1;
- 8 400 734 024 811 ÷ 2 = 4 200 367 012 405 + 1;
- 4 200 367 012 405 ÷ 2 = 2 100 183 506 202 + 1;
- 2 100 183 506 202 ÷ 2 = 1 050 091 753 101 + 0;
- 1 050 091 753 101 ÷ 2 = 525 045 876 550 + 1;
- 525 045 876 550 ÷ 2 = 262 522 938 275 + 0;
- 262 522 938 275 ÷ 2 = 131 261 469 137 + 1;
- 131 261 469 137 ÷ 2 = 65 630 734 568 + 1;
- 65 630 734 568 ÷ 2 = 32 815 367 284 + 0;
- 32 815 367 284 ÷ 2 = 16 407 683 642 + 0;
- 16 407 683 642 ÷ 2 = 8 203 841 821 + 0;
- 8 203 841 821 ÷ 2 = 4 101 920 910 + 1;
- 4 101 920 910 ÷ 2 = 2 050 960 455 + 0;
- 2 050 960 455 ÷ 2 = 1 025 480 227 + 1;
- 1 025 480 227 ÷ 2 = 512 740 113 + 1;
- 512 740 113 ÷ 2 = 256 370 056 + 1;
- 256 370 056 ÷ 2 = 128 185 028 + 0;
- 128 185 028 ÷ 2 = 64 092 514 + 0;
- 64 092 514 ÷ 2 = 32 046 257 + 0;
- 32 046 257 ÷ 2 = 16 023 128 + 1;
- 16 023 128 ÷ 2 = 8 011 564 + 0;
- 8 011 564 ÷ 2 = 4 005 782 + 0;
- 4 005 782 ÷ 2 = 2 002 891 + 0;
- 2 002 891 ÷ 2 = 1 001 445 + 1;
- 1 001 445 ÷ 2 = 500 722 + 1;
- 500 722 ÷ 2 = 250 361 + 0;
- 250 361 ÷ 2 = 125 180 + 1;
- 125 180 ÷ 2 = 62 590 + 0;
- 62 590 ÷ 2 = 31 295 + 0;
- 31 295 ÷ 2 = 15 647 + 1;
- 15 647 ÷ 2 = 7 823 + 1;
- 7 823 ÷ 2 = 3 911 + 1;
- 3 911 ÷ 2 = 1 955 + 1;
- 1 955 ÷ 2 = 977 + 1;
- 977 ÷ 2 = 488 + 1;
- 488 ÷ 2 = 244 + 0;
- 244 ÷ 2 = 122 + 0;
- 122 ÷ 2 = 61 + 0;
- 61 ÷ 2 = 30 + 1;
- 30 ÷ 2 = 15 + 0;
- 15 ÷ 2 = 7 + 1;
- 7 ÷ 2 = 3 + 1;
- 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.
1 101 101 010 100 111 259(10) = 1111 0100 0111 1110 0101 1000 1000 1110 1000 1101 0111 0100 0111 1001 1011(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 60.
- 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, 60,
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:
1 101 101 010 100 111 259(10) Base 10 integer number converted and written as a signed binary code (in base 2):
1 101 101 010 100 111 259(10) = 0000 1111 0100 0111 1110 0101 1000 1000 1110 1000 1101 0111 0100 0111 1001 1011
Spaces were used to group digits: for binary, by 4, for decimal, by 3.