What are the required steps to convert base 10 integer
number 1 110 101 000 010 464 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 110 101 000 010 464 ÷ 2 = 555 050 500 005 232 + 0;
- 555 050 500 005 232 ÷ 2 = 277 525 250 002 616 + 0;
- 277 525 250 002 616 ÷ 2 = 138 762 625 001 308 + 0;
- 138 762 625 001 308 ÷ 2 = 69 381 312 500 654 + 0;
- 69 381 312 500 654 ÷ 2 = 34 690 656 250 327 + 0;
- 34 690 656 250 327 ÷ 2 = 17 345 328 125 163 + 1;
- 17 345 328 125 163 ÷ 2 = 8 672 664 062 581 + 1;
- 8 672 664 062 581 ÷ 2 = 4 336 332 031 290 + 1;
- 4 336 332 031 290 ÷ 2 = 2 168 166 015 645 + 0;
- 2 168 166 015 645 ÷ 2 = 1 084 083 007 822 + 1;
- 1 084 083 007 822 ÷ 2 = 542 041 503 911 + 0;
- 542 041 503 911 ÷ 2 = 271 020 751 955 + 1;
- 271 020 751 955 ÷ 2 = 135 510 375 977 + 1;
- 135 510 375 977 ÷ 2 = 67 755 187 988 + 1;
- 67 755 187 988 ÷ 2 = 33 877 593 994 + 0;
- 33 877 593 994 ÷ 2 = 16 938 796 997 + 0;
- 16 938 796 997 ÷ 2 = 8 469 398 498 + 1;
- 8 469 398 498 ÷ 2 = 4 234 699 249 + 0;
- 4 234 699 249 ÷ 2 = 2 117 349 624 + 1;
- 2 117 349 624 ÷ 2 = 1 058 674 812 + 0;
- 1 058 674 812 ÷ 2 = 529 337 406 + 0;
- 529 337 406 ÷ 2 = 264 668 703 + 0;
- 264 668 703 ÷ 2 = 132 334 351 + 1;
- 132 334 351 ÷ 2 = 66 167 175 + 1;
- 66 167 175 ÷ 2 = 33 083 587 + 1;
- 33 083 587 ÷ 2 = 16 541 793 + 1;
- 16 541 793 ÷ 2 = 8 270 896 + 1;
- 8 270 896 ÷ 2 = 4 135 448 + 0;
- 4 135 448 ÷ 2 = 2 067 724 + 0;
- 2 067 724 ÷ 2 = 1 033 862 + 0;
- 1 033 862 ÷ 2 = 516 931 + 0;
- 516 931 ÷ 2 = 258 465 + 1;
- 258 465 ÷ 2 = 129 232 + 1;
- 129 232 ÷ 2 = 64 616 + 0;
- 64 616 ÷ 2 = 32 308 + 0;
- 32 308 ÷ 2 = 16 154 + 0;
- 16 154 ÷ 2 = 8 077 + 0;
- 8 077 ÷ 2 = 4 038 + 1;
- 4 038 ÷ 2 = 2 019 + 0;
- 2 019 ÷ 2 = 1 009 + 1;
- 1 009 ÷ 2 = 504 + 1;
- 504 ÷ 2 = 252 + 0;
- 252 ÷ 2 = 126 + 0;
- 126 ÷ 2 = 63 + 0;
- 63 ÷ 2 = 31 + 1;
- 31 ÷ 2 = 15 + 1;
- 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 110 101 000 010 464(10) = 11 1111 0001 1010 0001 1000 0111 1100 0101 0011 1010 1110 0000(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 50.
- 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, 50,
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 110 101 000 010 464(10) Base 10 integer number converted and written as a signed binary code (in base 2):
1 110 101 000 010 464(10) = 0000 0000 0000 0011 1111 0001 1010 0001 1000 0111 1100 0101 0011 1010 1110 0000
Spaces were used to group digits: for binary, by 4, for decimal, by 3.