-
Notifications
You must be signed in to change notification settings - Fork 746
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
Floating point to integer casts rounding wrong #642
Comments
@LBPHacker wait i thought i mentioned this before. I didn't? Oops. Well now it's an issue, so that helps. The +0.5f trick is slightly faster, so when negative numbers are impossible using it should be fine. Maybe make it into a function, i.e.
or similar, so that the safe usages of it are more obvious. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We likely have a lot of code that assumes floating point conversion to integer rounding toward negative infinity, while in fact it rounds toward 0.
The text was updated successfully, but these errors were encountered: