-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Convertion of negative f64 to u64. #72899
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
This is #10184 |
I thought #10184 was about NaN, Inf and ect. This one is a normal float as returned by |
It is about any out of bounds value. |
As you've noticed, this has changed in 1.45. This is part of #71269, so that both values return 0. The new rules are documented at https://doc.rust-lang.org/nightly/reference/expressions/operator-expr.html#semantics. |
That's just pure chance. Behavior is undefined in both cases (until #71269). When behavior is undefined, looking at what the final executable does is meaningless. I think this issue should be closed, it is a duplicate of #10184. |
I see, Thank you! |
I tried this code:
I expected to see this happen:
Should print
Instead, this happened:
Stable: 1.43.1
Beta channel
Build using the Beta version: 1.44.0-beta.4
(2020-05-23 02c25b3)
This one is actually correct. Sorry if it has been fixed, I have not found bug report for this, so I've decided to create this one.
Nightly channel
Build using the Nightly version: 1.45.0-nightly
(2020-05-31 5fd2f06)
The text was updated successfully, but these errors were encountered: