0
  • What number does the following word stand for?

    $$\color{red}{1}\;\;\;\;\color{blue}{10000101}\;\;\;\;11110010011110100000000$$

Where the red one is the sign (it's called the sign bit which determines the sign of the number), the blue binary number is the Exponent, and the other bits are significand precision.

Based on this link I tried to use the following formula:

$$\text{Value}=\left(-1\right)^{\operatorname{sign}}\cdot2^{\left(e-127\right)}\cdot\left(1+\sum_{i=1}^{23}b_{23-i}\ \cdot2^{-i}\right)$$

$$\text{Value}=$$$$\left(-1\right)^{\color{red}{1}}\cdot2^{\left(\color{blue}{133}-127\right)}\cdot\left(1+2^{-1}+2^{-2}+2^{-3}+2^{-4}+2^{-7}+2^{-10}+2^{-11}+2^{-12}+2^{-13}+2^{-15}\right)$$$$=-124.619140625$$

is that right?

  • In IEEE floats, the first black $1$ should rather be blue ... – Hagen von Eitzen Apr 10 '20 at 14:23
  • @HagenvonEitzen, the colors I've used were arbitrary and I used them to mention which number I'm referring to –  Apr 10 '20 at 14:24
  • Odd that you have 24 bits of "fraction", rather than your link's 23. – Eric Towers Apr 10 '20 at 14:25
  • @user715522: Hagen's point is that the leading $1$ in your mantissa should be part of the exponent. Then you have $8$ exponent bits like you expect. You also have $23$ mantissa bits, which is correct. A nit: it is a sign bit, not sign bits, as there is only one of them. – Ross Millikan Apr 10 '20 at 14:29
  • @RossMillikan, yu are right,I got it –  Apr 10 '20 at 14:37

1 Answers1

0

In the scripture: $$\color{red}{1}\;\;\;\;\color{blue}{10000101}\;\;\;\;11110010011110100000000$$ there are three different parts. In particular, the exponent is a natural number, so you hav to convert it from binary. The general rule to do this is: $$S=\sum_{i=0}^{N-1}2^i\cdot B_i$$ where $i=0$ means that you have to start from the right side of the binary number and $B_i$ is the $i-$term of the sequence of lenght $N$.

With this clarification, your formula becomes: $$V=\left(-1\right)^{\operatorname{sign}}\cdot2^{\left(\sum_{i=0}^{N-1}2^i\cdot B_i-127\right)}\cdot\left(1+\sum_{i=1}^{23}B_{23-i}\ \cdot2^{-i}\right)$$

Matteo
  • 6,581