You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class Test {
public static final float POSITIVE_INFINITY = Float.POSITIVE_INFINITY;
public static final float NEGATIVE_INFINITY = Float.NEGATIVE_INFINITY;
public static final float NaN = Float.NaN;
}
the disassembler produces the following:
version 1.8;
public class TestInf extends java.lang.Object [
SourceFile "TestInf.java";
] {
public static final float POSITIVE_INFINITY = ∞float;
public static final float NEGATIVE_INFINITY = -∞float;
public static final float NAN = NaNfloat;
public void <init>() {
line 1
aload_0
invokespecial java.lang.Object#void <init>()
return
}
public static void main(java.lang.String[]) {
line 8
getstatic java.lang.System#java.io.PrintStream out
ldc ∞float
invokevirtual java.io.PrintStream#void println(float)
line 9
getstatic java.lang.System#java.io.PrintStream out
ldc -∞float
invokevirtual java.io.PrintStream#void println(float)
line 10
getstatic java.lang.System#java.io.PrintStream out
ldc NaNfloat
invokevirtual java.io.PrintStream#void println(float)
line 11
return
}
}
This is because the conversion from number to string uses DecimalFormat here.
The assembler also cannot read this back in, since it cannot parse these constants (they aren't numbers).
The text was updated successfully, but these errors were encountered:
though DecimalFormat may still cause problems like not accurately expressing double/float (disassembing and then assembling back may get a different value, e.g. Double.MIN_VALUE and Double.MAX_VALUE), not a clever way to precisely serialize & print decimal numbers
If you compile the following:
the disassembler produces the following:
This is because the conversion from number to string uses
DecimalFormat here
.The assembler also cannot read this back in, since it cannot parse these constants (they aren't numbers).
The text was updated successfully, but these errors were encountered: