Those are the special ieee parameters
Binary number 1 00111 010
After all the math I get -5/1024
However, my buddy got -704
Who is right?
As the calculation below shows, it appears that you are correct, and the correct answer is -5/1024
:
Input: 1 00111 010
Mantissa: 1.010 base 2
Exponent: 111 base 2 = 7 base 10; 7 − 15 = -8
De-normalize: 1.010 base 2 × 2^-8 = .00000001010
The following table shows how you can convert the denormalized number into a base 10 decimal:
Exponent | 2^-8 | 2^-9 | 2^-10 | 2^-11 |
Decimal | 0.00390625 | 0.001953125 | 0.0009765625 | 0.00048828125 |
Bit | 1 | 0 | 1 | 0 |
Value | 0.00390625 | 0 | 0.0009765625 | 0 |
Total = 0.00390625 + 0.0009765625 = 0.0048828125
This value must then be negated because the sign bit is set. So the final result is -0.0048828125
. This equals -5/1024
which you originally got.
Here is a link to a great site which shows how to do the conversion step by step.