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

Overflow behaviour for double and long cast to int #65

Closed
rschumi0 opened this issue Oct 2, 2020 · 1 comment
Closed

Overflow behaviour for double and long cast to int #65

rschumi0 opened this issue Oct 2, 2020 · 1 comment

Comments

@rschumi0
Copy link

rschumi0 commented Oct 2, 2020

I noticed that in Java casts from double and long to int are handle differently when an overflow occurs, i.e., in the following code the results will be the Int.Max for the double cast and bits will be cut off for the long cast. In KJava both casts produce the same result, i.e., bits will be cut off.

System.out.println(((int)2147483648L));
System.out.println(((int)2147483648.0));
@rschumi0 rschumi0 closed this as completed Oct 2, 2020
@rschumi0
Copy link
Author

rschumi0 commented Oct 2, 2020

Duplicate of Issue #64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant