Skip to content
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

Fix incorrect Int#% overflow #7980

Merged
merged 1 commit into from
Jul 25, 2019
Merged

Conversation

asterite
Copy link
Member

@asterite asterite commented Jul 21, 2019

Fixes #7979

Doing (x ^ y) >= 0 doesn't work well for determining whether x and y have the same sign when their types are not the same (for example Int32 and Int64).

@asterite asterite added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:numeric labels Jul 21, 2019
src/int.cr Outdated Show resolved Hide resolved
Doing `(x ^ y) >= 0` doesn't work well for determining whether `x` and
`y` have the same sign when their types are not the same (for example
`Int32` and `Int64`).
@bcardiff bcardiff added this to the 0.30.0 milestone Jul 25, 2019
@bcardiff bcardiff merged commit 226f470 into crystal-lang:master Jul 25, 2019
dnamsons pushed a commit to dnamsons/crystal that referenced this pull request Jan 10, 2020
Doing `(x ^ y) >= 0` doesn't work well for determining whether `x` and
`y` have the same sign when their types are not the same (for example
`Int32` and `Int64`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:numeric
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Somehow mod operation causes overflow
3 participants