Why is a divide underflow only caused when the divisor is much smaller than the dividend, shouldn’t it occur anytime the denominator is close enough to zero regardless of the size of the dividend?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From http://www.strw.leidenuniv.nl/docs/intel/f_ug/ieee_ovw.htm
This implies that the error occurrs when the ratio of the dividend and divisor is small enough to exceed the precision of the floating point format, rather than any dependence on a specific value such as epsilon.
As the denominator approaches zero, assuming a non-zero numerator, the result of a division will approach infinity. As the numerator approaches zero, assuming a non-zero denominator, the result approaches zero. When this value gets small enough, an will occurr.
If the numerator and denominator are very close in value, even if they are very small, you can get a useful result, so a very small numerator does not necessarily cause an underflow.
Example:
In C#, epsilon is 1.401298E-45.
epsilon/epsilon == 1.0f
Even though the numerator is very, very small, the result is still a valid float.
Now, if you were to try something like this:
denominatorwill have an order of 1e-83. Since 83 far exceeds the maximum single-precision float exponent, the value will be clamped to zero. This is where the underflow occurrs.This generates a divide-by-zero instead of infinity, because the intermediate result, stored in
denominator, is first clamped to 0 before being used in the second operation.Whether you get an underflow or a divide-by zero can depend on the compiler, your use and order of parenthisis, etc.
For instance, again in C#:
as well as
gives 20971522.0f.
However, the mathematically equivelant expression:
gives Infinity.