We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
0.149-SNAPSHOT (commit 22b3529)
javac 11.0.5
Some necessary casts are omitted when casting values to floating point and integer types.
Source:
class FloatingPointCasting { long getLong() { return 9223372036854775806L; } void test() { long b = (long) (double) getLong(); System.out.println(b == getLong()); // Prints "false" } public static void main(String ... args) { new FloatingPointCasting().test(); } }
Decompiled output:
class FloatingPointCasting { FloatingPointCasting() { } long getLong() { return 0x7FFFFFFFFFFFFFFEL; } void test() { long l = this.getLong(); System.out.println(l == this.getLong()); } public static void main(String ... arrstring) { new CharCasting().test(); } }
The text was updated successfully, but these errors were encountered:
Damn. You're on form this week. I can't keep up. ;)
It's fun to notice that constant folding means this isn't always an issue (see https://github.com/leibnitz27/cfr_tests/blob/master/src_6/org/benf/cfr/tests/FloatingPointCasting2.java )
Anyway, fixed ;)
Sorry, something went wrong.
fd6d645
No branches or pull requests
CFR version
0.149-SNAPSHOT (commit 22b3529)
Compiler
javac 11.0.5
Description
Some necessary casts are omitted when casting values to floating point and integer types.
Source:
Decompiled output:
The text was updated successfully, but these errors were encountered: