-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent underflow warnings #9568
Comments
Under IEEE 754 default exception handling (IEEE 754-2008 section 7.5), the underflow flag is raised only if the exact result of the arithmetic operation was not representable. As the standard says
I suspect that that's the cause of the apparent inconsistency here. |
Thanks Mark, that does look like what is happening. In the stackoverflow question, the warnings actually arise during a division of complex numbers.
I think this is because the multiplication underflow described earlier occurs in an intermediate calculation in https://github.com/numpy/numpy/blob/master/numpy/core/src/umath/loops.c.src#L2517. In this case, the underflow warning seems spurious--it is the result of an implementation detail, and probably of no use to a user. Does anyone agree, and if so, is it worth the effort to fix it? |
Closing, seems correct as per IEEE (as per comments). And frankly, I don't think we should mess with it if was incorrect... making sure that underflow flags are correct across compilers and math libs sounds like the stuff nightmares are made from. EDIT: Hmmpf, I suppose it is correct that possible the division shouldn't do this (i.e. it drops out of divmod or so). But, I still don't think we should spend any cycles on it, so leaving it closed. |
This inconsistent warning of underflow was reported on stackoverflow: https://stackoverflow.com/questions/45703529/why-does-complex-floating-point-division-underflow-weirdly-with-numpy
I think the following are cases of the same inconsistency (using numpy 1.13.1):
The following multiplications do not trigger an underflow warning:
But this does:
In all the above cases, the result is a denormal number. Shouldn't they all trigger the underflow warning?
Does this have something to do with the underlying bit patterns of the multiplicands?
The text was updated successfully, but these errors were encountered: