Computer Science Asked by Team B.I on December 19, 2021
We do check for the mantisas overflow in floating point addition
e.g.
If we are adding $8.02 times 10^3 + 9.01 times 10^3 =17.03 times 10^3$ i.e we get an overflow, so we shift the number right and increase the value of exponent.
But does it occurs during floating point multiplication?
According to my logic, it should occur. because $9.99times9.99=99.80$ which is a mantissa overflow, but that’s not the case.
I have referred to Morris Mano’s books and William Wtallings Computer Organization and Architecture book but none of those books mentioned about floating-point multiplication mantissa overflow.
So I feel like I am wrong.
Please tell me where I am wrong?
When we multiply, the answer is stored in 2 registers. When we multiply 2 numbers the results length does not exceed ($n_1+n_2$) where $n_1$ is length of 1st number and $n_2$ is length of second number. So there is no chance of overflow here as the length of 2 registers is greater than or equal to $n_1+n_2$.
Answered by pavan kumar on December 19, 2021
Compare $(9.99 cdot 10^2) cdot (9.99 cdot 10^3) = 9.98001 cdot 10^6$ and $(1.01 cdot 10^2) cdot (1.01 cdot 10^3) = 1.0201 cdot 10^5$. One has a higher exponent than the other.
So in base 10, you'd check if the product of the two mantissas is ≥ 10, and in this case move the decimal point to the left (99.8001 becomes 9.98001) and increase the exponent. Same in base 2, where you'd need to check if the product of the mantissas is ≥ 2 or not.
PS. We could obviously in base b require not that 1 <= m < b, where m is the mantissa, but that 1/b <= m < 1. In that case overflow is impossible but we need to check for underflow.
Answered by gnasher729 on December 19, 2021
You are both wrong and right.
The wrong part is that floating point numbers are stored binary in computers of today. Your example is in decimal.
You are right in that what call mantissa overflow actually happens. Before the return to user program however the FPU does a renormalization. There are a few odd cases of course. You might want to read up on ieee 754 standard.
Answered by ghellquist on December 19, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP