-
Notifications
You must be signed in to change notification settings - Fork 215
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
pow with integer arrays that overflow differs from numpy in 2.8.7 #454
Comments
You can see the context here for the changes were made: 2.8.4 was ignoring the virtual machine (VM) and short-cutting the calculation, but the implementation was buggy. Someone at some point, put in a check implemented a I would argue that the NumPy behavior is also wrong. NumPy raises an exception if you feed a negative exponent to an integer base. It should also error in this case since the answer is clearly not The VM doesn't have any faculty to, for example, set an error flag that would result in an exception to be raised after the calculation is completed. |
Agreed that the numpy result is also not correct/useful. So in general for numexpr, any overflowing expression is expected to truncate at the max value of the specified data type? |
How NumExpr will behave in this situation will depend on the CPU architecture I think... C++ doesn't specify a behavior for integer overflow conditions so it's undefined. |
The other operations don't - pow is special because it's implemented by casting to double and back. See pandas-dev/pandas#54546. |
Message to comment on stale issues. If none provided, will not mark issues stale |
It appears that pow was not implemented in 2.8.4 and newly implemented(?) in 2.8.7, but it appears that pow that overflows has differing behavior from numpy
The text was updated successfully, but these errors were encountered: