-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
arith-oflo: what is semantics of divide int::MIN.wrapped_div(-1)
#964
Comments
int::MIN.wrapped_div(-1)
int::MIN.wrapped_div(-1)
(wait was my logic in the above totally bogus? yikes! namely, But in any case, there are other parts in the reasoning above that are really flawed; in particular, it should probably yield |
See discussion, albeit one-sided, in: rust-lang/rfcs#964
See discussion, albeit one-sided, in: rust-lang/rfcs#964
I am working through implementing #560
I had thought, from the name "wrapping", that
int::MIN.wrapped_div(-1)
would be defined as follows:but then I saw this comment on the RFC thread:
#560 (comment)
which suggests: "there is no undefined behaviour or values left (if we agree to defining the result of INT_MIN/-1 as INT_MAX)."
My thinking is that if one wants the latter semantic, then maybe we should give it a name other than
wrapping_div
... e.g. maybe have both:keywords: arithmetic overflow division divide wrapping
The text was updated successfully, but these errors were encountered: