Signed: Integer -> Binary: 23 042 060 Convert the Integer Number to a Signed Binary. Converting and Writing the Base Ten Decimal System Signed Integer as Binary Code (Written in Base Two)
Signed integer number 23 042 060(10)
converted and written as a signed binary (base 2) = ?
1. Divide the number repeatedly by 2:
Keep track of each remainder.
We stop when we get a quotient that is equal to zero.
- division = quotient + remainder;
- 23 042 060 ÷ 2 = 11 521 030 + 0;
- 11 521 030 ÷ 2 = 5 760 515 + 0;
- 5 760 515 ÷ 2 = 2 880 257 + 1;
- 2 880 257 ÷ 2 = 1 440 128 + 1;
- 1 440 128 ÷ 2 = 720 064 + 0;
- 720 064 ÷ 2 = 360 032 + 0;
- 360 032 ÷ 2 = 180 016 + 0;
- 180 016 ÷ 2 = 90 008 + 0;
- 90 008 ÷ 2 = 45 004 + 0;
- 45 004 ÷ 2 = 22 502 + 0;
- 22 502 ÷ 2 = 11 251 + 0;
- 11 251 ÷ 2 = 5 625 + 1;
- 5 625 ÷ 2 = 2 812 + 1;
- 2 812 ÷ 2 = 1 406 + 0;
- 1 406 ÷ 2 = 703 + 0;
- 703 ÷ 2 = 351 + 1;
- 351 ÷ 2 = 175 + 1;
- 175 ÷ 2 = 87 + 1;
- 87 ÷ 2 = 43 + 1;
- 43 ÷ 2 = 21 + 1;
- 21 ÷ 2 = 10 + 1;
- 10 ÷ 2 = 5 + 0;
- 5 ÷ 2 = 2 + 1;
- 2 ÷ 2 = 1 + 0;
- 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.
23 042 060(10) = 1 0101 1111 1001 1000 0000 1100(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 25.
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, 25,
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:
Number 23 042 060(10), a signed integer number (with sign),
converted from decimal system (from base 10)
and written as a signed binary (in base 2):
23 042 060(10) = 0000 0001 0101 1111 1001 1000 0000 1100
The first bit (the leftmost) is reserved for the sign:
0 = positive integer number, 1 = negative integer number
Spaces were used to group digits: for binary, by 4, for decimal, by 3.
Convert signed integer numbers from the decimal system (base ten) to signed binary (written in base two)
How to convert a base ten signed integer number to signed binary:
1) Divide the positive version of the number repeatedly by 2, keeping track of each remainder. Stop when getting a quotient that is 0.
2) Construct the base two representation by taking the previously calculated remainders starting from the last remainder up to the first one.
3) Construct the positive binary computer representation so that the first bit is 0.
4) Only if the initial number is negative, change the first bit (the leftmost), from 0 to 1. The leftmost bit is reserved for the sign, 1 = negative, 0 = positive.