What are the required steps to convert base 10 integer
number 61 346 456 442 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;
- 61 346 456 442 ÷ 2 = 30 673 228 221 + 0;
- 30 673 228 221 ÷ 2 = 15 336 614 110 + 1;
- 15 336 614 110 ÷ 2 = 7 668 307 055 + 0;
- 7 668 307 055 ÷ 2 = 3 834 153 527 + 1;
- 3 834 153 527 ÷ 2 = 1 917 076 763 + 1;
- 1 917 076 763 ÷ 2 = 958 538 381 + 1;
- 958 538 381 ÷ 2 = 479 269 190 + 1;
- 479 269 190 ÷ 2 = 239 634 595 + 0;
- 239 634 595 ÷ 2 = 119 817 297 + 1;
- 119 817 297 ÷ 2 = 59 908 648 + 1;
- 59 908 648 ÷ 2 = 29 954 324 + 0;
- 29 954 324 ÷ 2 = 14 977 162 + 0;
- 14 977 162 ÷ 2 = 7 488 581 + 0;
- 7 488 581 ÷ 2 = 3 744 290 + 1;
- 3 744 290 ÷ 2 = 1 872 145 + 0;
- 1 872 145 ÷ 2 = 936 072 + 1;
- 936 072 ÷ 2 = 468 036 + 0;
- 468 036 ÷ 2 = 234 018 + 0;
- 234 018 ÷ 2 = 117 009 + 0;
- 117 009 ÷ 2 = 58 504 + 1;
- 58 504 ÷ 2 = 29 252 + 0;
- 29 252 ÷ 2 = 14 626 + 0;
- 14 626 ÷ 2 = 7 313 + 0;
- 7 313 ÷ 2 = 3 656 + 1;
- 3 656 ÷ 2 = 1 828 + 0;
- 1 828 ÷ 2 = 914 + 0;
- 914 ÷ 2 = 457 + 0;
- 457 ÷ 2 = 228 + 1;
- 228 ÷ 2 = 114 + 0;
- 114 ÷ 2 = 57 + 0;
- 57 ÷ 2 = 28 + 1;
- 28 ÷ 2 = 14 + 0;
- 14 ÷ 2 = 7 + 0;
- 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.
61 346 456 442(10) = 1110 0100 1000 1000 1000 1010 0011 0111 1010(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 36.
- 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, 36,
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:
61 346 456 442(10) Base 10 integer number converted and written as a signed binary code (in base 2):
61 346 456 442(10) = 0000 0000 0000 0000 0000 0000 0000 1110 0100 1000 1000 1000 1010 0011 0111 1010
Spaces were used to group digits: for binary, by 4, for decimal, by 3.