2
$\begingroup$

Here is the example problem slide I am working with:

slide with task

I understand how to get the exponent, its just 2+128=130-127=3

I understand the first bit is the sign bit for positive or negative.

I just get lost with the mantissa. I know each mantissa has to have a 1 before the decimal, but I'm unsure where the .75 came from. 1100000000000000000000 isn't 75 in decimal I mean right?

How do I calculate the mantissa with floating point numbers in binary?

$\endgroup$
0
4
$\begingroup$

The number after "." is calculated by $$\frac1{2^n}$$ instead of $$2^n$$ So $$1.11 = 2^0 + (1/2^1) + (1/2^2)$$ $$= 1 + 0.5 + 0.25$$ $$=1.75$$

$\endgroup$
2
$\begingroup$

Received answer from /u/empire539 on Reddit.

Yes, there is an implicitly "hidden" bit, so if your mantissa is 1100000000000000000000, then that corresponds to the base 2 number 1.11.

Now, if you want to compute the value of .11 part, you just do the same thing as you would do to convert a normal binary number to decimal: multiply each bit by a power of 2.

So, for example, if you wanted to convert the number 1010.1 to decimal, you would do: $1(2^3) + 0(2^2) + 1(2^1) + 0(2^0) + 1(2^{-1}) = 8 + 2 + 1/2 = 10.5$

$\endgroup$
1
  • $\begingroup$ Please add your own (partial) answer to the question and update what the question in question now is. $\endgroup$ – Lutz Lehmann Oct 17 '15 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.