Fixed NaN and INFINITY values

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@825 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent cf14cfde92
commit 0b299aecb7
  1. 18
      jode/jode/expr/ConstOperator.java

@ -198,8 +198,24 @@ public class ConstOperator extends NoArgOperator {
} }
if (type.isOfType(Type.tLong)) if (type.isOfType(Type.tLong))
return strVal+"L"; return strVal+"L";
if (type.isOfType(Type.tFloat)) if (type.isOfType(Type.tFloat)) {
if (strVal.equals("NaN"))
return "Float.NaN";
if (strVal.equals("-Infinity"))
return "Float.NEGATIVE_INFINITY";
if (strVal.equals("Infinity"))
return "Float.POSITIVE_INFINITY";
return strVal+"F"; return strVal+"F";
}
if (type.isOfType(Type.tDouble)) {
if (strVal.equals("NaN"))
return "Double.NaN";
if (strVal.equals("-Infinity"))
return "Double.NEGATIVE_INFINITY";
if (strVal.equals("Infinity"))
return "Double.POSITIVE_INFINITY";
return strVal;
}
if (!type.isOfType(Type.tInt) if (!type.isOfType(Type.tInt)
&& (type.getHint().equals(Type.tByte) && (type.getHint().equals(Type.tByte)
|| type.getHint().equals(Type.tShort)) || type.getHint().equals(Type.tShort))

Loading…
Cancel
Save