Signed: Integer -> Binary: 4 324 020 245 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 4 324 020 245(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;
- 4 324 020 245 ÷ 2 = 2 162 010 122 + 1;
- 2 162 010 122 ÷ 2 = 1 081 005 061 + 0;
- 1 081 005 061 ÷ 2 = 540 502 530 + 1;
- 540 502 530 ÷ 2 = 270 251 265 + 0;
- 270 251 265 ÷ 2 = 135 125 632 + 1;
- 135 125 632 ÷ 2 = 67 562 816 + 0;
- 67 562 816 ÷ 2 = 33 781 408 + 0;
- 33 781 408 ÷ 2 = 16 890 704 + 0;
- 16 890 704 ÷ 2 = 8 445 352 + 0;
- 8 445 352 ÷ 2 = 4 222 676 + 0;
- 4 222 676 ÷ 2 = 2 111 338 + 0;
- 2 111 338 ÷ 2 = 1 055 669 + 0;
- 1 055 669 ÷ 2 = 527 834 + 1;
- 527 834 ÷ 2 = 263 917 + 0;
- 263 917 ÷ 2 = 131 958 + 1;
- 131 958 ÷ 2 = 65 979 + 0;
- 65 979 ÷ 2 = 32 989 + 1;
- 32 989 ÷ 2 = 16 494 + 1;
- 16 494 ÷ 2 = 8 247 + 0;
- 8 247 ÷ 2 = 4 123 + 1;
- 4 123 ÷ 2 = 2 061 + 1;
- 2 061 ÷ 2 = 1 030 + 1;
- 1 030 ÷ 2 = 515 + 0;
- 515 ÷ 2 = 257 + 1;
- 257 ÷ 2 = 128 + 1;
- 128 ÷ 2 = 64 + 0;
- 64 ÷ 2 = 32 + 0;
- 32 ÷ 2 = 16 + 0;
- 16 ÷ 2 = 8 + 0;
- 8 ÷ 2 = 4 + 0;
- 4 ÷ 2 = 2 + 0;
- 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.
4 324 020 245(10) = 1 0000 0001 1011 1011 0101 0000 0001 0101(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 33.
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, 33,
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:
Number 4 324 020 245(10), a signed integer number (with sign),
converted from decimal system (from base 10)
and written as a signed binary (in base 2):
4 324 020 245(10) = 0000 0000 0000 0000 0000 0000 0000 0001 0000 0001 1011 1011 0101 0000 0001 0101
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.