What are the required steps to convert base 10 integer
number 1 723 962 950 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 723 962 950 ÷ 2 = 861 981 475 + 0;
- 861 981 475 ÷ 2 = 430 990 737 + 1;
- 430 990 737 ÷ 2 = 215 495 368 + 1;
- 215 495 368 ÷ 2 = 107 747 684 + 0;
- 107 747 684 ÷ 2 = 53 873 842 + 0;
- 53 873 842 ÷ 2 = 26 936 921 + 0;
- 26 936 921 ÷ 2 = 13 468 460 + 1;
- 13 468 460 ÷ 2 = 6 734 230 + 0;
- 6 734 230 ÷ 2 = 3 367 115 + 0;
- 3 367 115 ÷ 2 = 1 683 557 + 1;
- 1 683 557 ÷ 2 = 841 778 + 1;
- 841 778 ÷ 2 = 420 889 + 0;
- 420 889 ÷ 2 = 210 444 + 1;
- 210 444 ÷ 2 = 105 222 + 0;
- 105 222 ÷ 2 = 52 611 + 0;
- 52 611 ÷ 2 = 26 305 + 1;
- 26 305 ÷ 2 = 13 152 + 1;
- 13 152 ÷ 2 = 6 576 + 0;
- 6 576 ÷ 2 = 3 288 + 0;
- 3 288 ÷ 2 = 1 644 + 0;
- 1 644 ÷ 2 = 822 + 0;
- 822 ÷ 2 = 411 + 0;
- 411 ÷ 2 = 205 + 1;
- 205 ÷ 2 = 102 + 1;
- 102 ÷ 2 = 51 + 0;
- 51 ÷ 2 = 25 + 1;
- 25 ÷ 2 = 12 + 1;
- 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.
1 723 962 950(10) = 110 0110 1100 0001 1001 0110 0100 0110(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 31.
- 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, 31,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 32.
4. Get the positive binary computer representation on 32 bits (4 Bytes):
If needed, add extra 0s in front (to the left) of the base 2 number, up to the required length, 32:
1 723 962 950(10) Base 10 integer number converted and written as a signed binary code (in base 2):
1 723 962 950(10) = 0110 0110 1100 0001 1001 0110 0100 0110
Spaces were used to group digits: for binary, by 4, for decimal, by 3.