Translate the number 2.312510 в binary like this:
the Integer part of the number is divided by the base of the new number system:
2 | 2 | |
-2 | 1 | |
0 | | |
|
the Fractional part of the number is multiplied by the base of the new number system:
|
0. | 3125*2 |
0 | .625*2 |
1 | .25*2 |
0 | .5*2 |
1 | .0*2 |
the result of the conversion was:
2.312510 = 10.01012
You specified the size of your number 2 byte.
negative fractional numbers are not supported at this time. Therefore, only the integer part of the number is involved in the further translation.
Add a signed bit to the number like this:
102 = 10000000000000102
Since the number you entered is negative, you need to translate it from the direct code to the additional one.
to do this, first perform the conversion from direct code to reverse by inverting all bits except the signed one, then get the direct code by adding 1 bit.
1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | direct code |
| | | | | | | | | | | | | | . | | |
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | reverse code |
| | | | | | | | | | | | | | + | 1 | +1 bit |
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | additional code |
the Final answer: -2.312510 = 11111111111111102 (2 byte)