-
-
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
Deprecate/remove silent truncation on assignment of floats into an integer array #7730
Comments
The behaviour is of course correct, |
Note that numpy doesn't round in these cases, it truncates. @seberg I thought this was deprecated, but it doesn't seem so. |
There is only a deprecation for the in place ufuncs, maybe we should think about making this deprecate too? |
@seberg Sounds like a good idea, we should raise it on the list. |
Sounds like everyone is in favor, so I renamed the bug report. I guess concretely the desired change should follow the same path we used for in-place operations? Which IIRC was that we switched it to same_kind casting, with a deprecation period. |
Yeah, would have to be a pretty long deprecation just like there. I am a little worried that the workaround with copyto or casting the right hand side is sometimes a bit annoying. But I suppose that it should be rare that a bit of explicit casting/more convolved stuff does not hurt and the error can easily tell you the solution. |
I think this is an important usability issue. One of my labmates @sumeetsk wasted a month of research effort on this bug (and just before his defense too). It boiled down to >>> a = np.array([0, 1, 2])
>>> a[0] = 1.1
>>> print(a)
... array([1, 1, 2]) which is unexpected. This issue is also mentioned in a textbook:
I'll try to submit a PR for this issue. This is still around in NumPy 1.14.3, and the recent release notes don't seem to mention it. |
Overflow and truncation seem to be mentioned often as issues. Maybe we could have a |
(Note that this issue and #8733 are basically duplicates.) |
Ubuntu 14.04
Python 2.7.11
The text was updated successfully, but these errors were encountered: