-2
$\begingroup$

I was studying the product with floating point and I saw this example. I made the translation, sorry if something is not grammatically correct.

![enter image description here][1]

$\endgroup$
  • $\begingroup$ The book is wrong. As you write, $2.5\times 12.125 = 30.3125$. $\endgroup$ – Yuval Filmus Nov 7 '14 at 1:06
  • $\begingroup$ The problem is that with the outcome of the product x1*x2 that I put, I dont get to 30.3125. So I am doing something wrong too. $\endgroup$ – Richy Nov 7 '14 at 1:14
  • $\begingroup$ Why not? $(11110.0101)_2 = (30.3125)_{10}$. $\endgroup$ – Yuval Filmus Nov 7 '14 at 1:15
  • 2
    $\begingroup$ Don't use images as main content of your post. This makes your question impossible to search and inaccessible to the visually impaired; we don't like that. Please transcribe text and maths (note that you can use LaTeX) and don't forget to give proper attribution to your sources! $\endgroup$ – Raphael Nov 7 '14 at 8:35
  • 1
    $\begingroup$ This question consists of scanned text and is thus unsearchable. It can be reopened if the text is posted as text. $\endgroup$ – Gilles 'SO- stop being evil' Nov 7 '14 at 14:20
2
$\begingroup$

Here is the complete calculation: $$ \begin{align*} &2.5 = (.101)_2 \times 2^2 \\ &12.125 = (.1100001)_2 \times 2^4 \\ &(.101)_2 \times 2^2 \cdot (.1100001)_2 \times 2^4 = (.0111100101)_2 \times 2^6 = (.111100101)_2 \times 2^5 \\ &(.111100101)_2 \times 2^5 = 30.3125 \end{align*} $$ Ignore what the book says, and just make sure that you understand why this calculation works out.

Also, actual floating point formats usually omit the leading 1 in the mantissa, which is usually interpreted as the first digit before the dot rather than the first after the dot. Using this convention, the exponents add without correction (under your convention, you have to subtract 1, essentially since 1/2 times 1/2 equals 1/4 rather than 1/2).

$\endgroup$
  • $\begingroup$ Just one more thing: 1100001 x 101 = 111100101. When i made the product I get this, but you get a zero before the first one. (0111100101) $\endgroup$ – Richy Nov 7 '14 at 2:33
  • $\begingroup$ That's because I multiply numbers rather than strings of digits. My numbers have meaning. Try calculating $.1\times .1=.01$ – even though $1\times 1=1$, you get the extra zero. $\endgroup$ – Yuval Filmus Nov 7 '14 at 14:53

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